1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
mod error;
mod exchanges;
mod market;
mod market_type;
mod utils;
pub use error::Error;
pub use market::Market;
pub use market_type::{get_market_types, MarketType};
use error::Result;
pub fn fetch_symbols(exchange: &str, market_type: MarketType) -> Result<Vec<String>> {
match exchange {
"binance" => exchanges::binance::fetch_symbols(market_type),
"bitfinex" => exchanges::bitfinex::fetch_symbols(market_type),
"bitmex" => exchanges::bitmex::fetch_symbols(market_type),
"bitstamp" => exchanges::bitstamp::fetch_symbols(market_type),
"coinbase_pro" => exchanges::coinbase_pro::fetch_symbols(market_type),
"deribit" => exchanges::deribit::fetch_symbols(market_type),
"ftx" => exchanges::ftx::fetch_symbols(market_type),
"huobi" => exchanges::huobi::fetch_symbols(market_type),
"kraken" => exchanges::kraken::fetch_symbols(market_type),
"mxc" => exchanges::mxc::fetch_symbols(market_type),
"okex" => exchanges::okex::fetch_symbols(market_type),
_ => panic!("Unsupported exchange {}", exchange),
}
}
pub fn fetch_markets(exchange: &str, market_type: MarketType) -> Result<Vec<Market>> {
match exchange {
"binance" => exchanges::binance::fetch_markets(market_type),
"bitfinex" => exchanges::bitfinex::fetch_markets(market_type),
"bitmex" => exchanges::bitmex::fetch_markets(market_type),
"bitstamp" => exchanges::bitstamp::fetch_markets(market_type),
"coinbase_pro" => exchanges::coinbase_pro::fetch_markets(market_type),
"deribit" => exchanges::deribit::fetch_markets(market_type),
"ftx" => exchanges::ftx::fetch_markets(market_type),
"huobi" => exchanges::huobi::fetch_markets(market_type),
"kraken" => exchanges::kraken::fetch_markets(market_type),
"mxc" => exchanges::mxc::fetch_markets(market_type),
"okex" => exchanges::okex::fetch_markets(market_type),
_ => panic!("Unsupported exchange {}", exchange),
}
}