ccxt 使用笔记 1- 单币种跨交易所搬砖练习

本贴最后更新于 2245 天前,其中的信息可能已经时过境迁

ccxt 很方便,把各个交易所的接口统一化了,使用起来很方便,入门笔记记录在此,熟悉了这些 api 后就可以方便的搬砖了。
自己写了个跨交易所搬砖的 demo,目前可以在指定交易对和交易所的情况下找出当前时间卖的最便宜的(最低卖一)进行买入,和买的最贵的(最高买一)进行卖出,这样低买高卖搬砖套利,自动下单交易的代码,那一部分需要接入个人账户的 key,另外看到这种方法实际搬砖利润不大,还有手续费,交易滑点等因素就没有实际操作,代码详见

https://github.com/whitespur/ccxt/blob/master/examples/py/study1.py

文档地址:

https://github.com/ccxt/ccxt/wiki/Manual

Exchange 交易所

['binance', 'fcoin', 'gateio', 'huobi', 'kucoin', 'okex']

['BTC', 'ETH', 'XRP', 'BCH', 'EOS', 'XLM', 'LTC', 'ADA', 'XMR', 'TRX', 'BNB', 'ONT', 'NEO', 'DCR']

https://github.com/ccxt/ccxt/wiki/Manual#markets

The structure of the library can be outlined as follows:

                             User
+-------------------------------------------------------------+
|                            CCXT                             |
+------------------------------+------------------------------+
|            Public            |           Private            |
+=============================================================+
│                              .                              |
│                    The Unified CCXT API                     |
│                              .                              |
|       loadMarkets            .           fetchBalance       |
|       fetchMarkets           .            createOrder       |
|       fetchCurrencies        .            cancelOrder       |
|       fetchTicker            .             fetchOrder       |
|       fetchTickers           .            fetchOrders       |
|       fetchOrderBook         .        fetchOpenOrders       |
|       fetchOHLCV             .      fetchClosedOrders       |
|       fetchTrades            .          fetchMyTrades       |
|                              .                deposit       |
|                              .               withdraw       |
│                              .                              |
+=============================================================+
│                              .                              |
|                     Custom Exchange API                     |
|         (Derived Classes And Their Implicit Methods)        |
│                              .                              |
|       publicGet...           .          privateGet...       |
|       publicPost...          .         privatePost...       |
|                              .          privatePut...       |
|                              .       privateDelete...       |
|                              .                   sign       |
│                              .                              |
+=============================================================+
│                              .                              |
|                      Base Exchange Class                    |
│                              .                              |
+=============================================================+

实例化交易所

# Python
import ccxt
exchange = ccxt.okcoinusd () # default id
okcoin1 = ccxt.okcoinusd ({ 'id': 'okcoin1' })
okcoin2 = ccxt.okcoinusd ({ 'id': 'okcoin2' })
id = 'btcchina'
btcchina = eval ('ccxt.%s ()' % id)
gdax = getattr (ccxt, 'gdax') ()

# from variable id
exchange_id = 'binance'
exchange_class = getattr(ccxt, exchange_id)
exchange = exchange_class({
    'apiKey': 'YOUR_API_KEY',
    'secret': 'YOUR_SECRET',
    'timeout': 30000,
    'enableRateLimit': True,
})


Exchange Structure 交易所结构

Every exchange has a set of properties and methods, most of which you can override by passing an associative array of params to an exchange constructor. You can also make a subclass and override everything.

Here's an overview of base exchange properties with values added for example:

{
    'id':   'exchange'                  // lowercase string exchange id
    'name': 'Exchange'                  // human-readable string
    'countries': [ 'US', 'CN', 'EU' ],  // array of ISO country codes
    'urls': {
        'api': 'https://api.example.com/data',  // string or dictionary of base API URLs
        'www': 'https://www.example.com'        // string website URL
        'doc': 'https://docs.example.com/api',  // string URL or array of URLs
    },
    'version':         'v1',            // string ending with digits
    'api':             { ... },         // dictionary of api endpoints
    'has': {                            // exchange capabilities
        'CORS': false,
        'publicAPI': true,
        'privateAPI': true,
        'cancelOrder': true,
        'createDepositAddress': false,
        'createOrder': true,
        'deposit': false,
        'fetchBalance': true,
        'fetchClosedOrders': false,
        'fetchCurrencies': false,
        'fetchDepositAddress': false,
        'fetchMarkets': true,
        'fetchMyTrades': false,
        'fetchOHLCV': false,
        'fetchOpenOrders': false,
        'fetchOrder': false,
        'fetchOrderBook': true,
        'fetchOrders': false,
        'fetchTicker': true,
        'fetchTickers': false,
        'fetchBidsAsks': false,
        'fetchTrades': true,
        'withdraw': false,
    },
    'timeframes': {                     // empty if the exchange !has.fetchOHLCV
        '1m': '1minute',
        '1h': '1hour',
        '1d': '1day',
        '1M': '1month',
        '1y': '1year',
    },
    'timeout':          10000,          // number in milliseconds
    'rateLimit':        2000,           // number in milliseconds
    'userAgent':       'ccxt/1.1.1 ...' // string, HTTP User-Agent header
    'verbose':          false,          // boolean, output error details
    'markets':         { ... }          // dictionary of markets/pairs by symbol
    'symbols':         [ ... ]          // sorted list of string symbols (traded pairs)
    'currencies':      { ... }          // dictionary of currencies by currency code
    'markets_by_id':   { ... },         // dictionary of dictionaries (markets) by id
    'proxy': 'https://crossorigin.me/', // string URL
    'apiKey':   '92560ffae9b8a0421...', // string public apiKey (ASCII, hex, Base64, ...)
    'secret':   '9aHjPmW+EtRRKN/Oi...'  // string private secret key
    'password': '6kszf4aci8r',          // string password
    'uid':      '123456',               // string user id
}


Markets 市场交易对信息

Each exchange is a place for trading some kinds of valuables. Sometimes they are called with various different terms like instruments, symbols, trading pairs, currencies, tokens, stocks, commodities, contracts, etc, but they all mean the same – a trading pair, a symbol or a financial instrument.

In terms of the ccxt library, every exchange offers multiple markets within itself. The set of markets differs from exchange to exchange opening possibilities for cross-exchange and cross-market arbitrage. A market is usually a pair of traded crypto/fiat currencies.

Market Structure

{
    'id':     'btcusd',   // string literal for referencing within an exchange
    'symbol': 'BTC/USD',  // uppercase string literal of a pair of currencies
    'base':   'BTC',      // uppercase string, base currency, 3 or more letters
    'quote':  'USD',      // uppercase string, quote currency, 3 or more letters
    'active': true,       // boolean, market status
    'precision': {        // number of decimal digits "after the dot"
        'price': 8,       // integer
        'amount': 8,      // integer
        'cost': 8,        // integer
    },
    'limits': {           // value limits when placing orders on this market
        'amount': {
            'min': 0.01,  // order amount should be > min
            'max': 1000,  // order amount should be < max
        },
        'price': { ... }, // same min/max limits for the price of the order
        'cost':  { ... }, // same limits for order cost = price * amount
    },
    'info':      { ... }, // the original unparsed market info from the exchange
}

gate_markets['BTC/USDT']

Naming Consistency
There is a bit of term ambiguity across various exchanges that may cause confusion among newcoming traders. Some exchanges call markets as pairs, whereas other exchanges call symbols as products. In terms of the ccxt library, each exchange contains one or more trading markets. Each market has an id and a symbol. Most symbols are pairs of base currency and quote currency.

Exchanges → Markets → Symbols → Currencies

remember the following rule: base is always before the slash, quote is always after the slash in any symbol and with any market.

base currency ↓
BTC / USDT
ETH / BTC
DASH / ETH
↑ quote currency


API 接口列表

The endpoints definition is a full list of ALL API URLs exposed by an exchange. This list gets converted to callable methods upon exchange instantiation. Each URL in the API endpoint list gets a corresponding callable method. This is done automatically for all exchanges, therefore the ccxt library supports all possible URLs offered by crypto exchanges.
gate.api['public']['get']
gate.api['private']['post']

Each implicit method gets a unique name which is constructed from the .api definition. For example, a private HTTPS PUT https://api.exchange.com/order/{id}/cancel endpoint will have a corresponding exchange method named .privatePutOrderIdCancel()/.private_put_order_id_cancel(). A public HTTPS GET https://api.exchange.com/market/ticker/{pair} endpoint would result in the corresponding method named .publicGetTickerPair()/.public_get_ticker_pair(), and so on.

Public/Private API
API URLs are often grouped into two sets of methods called a public API for market data and a private API for trading and account access. These groups of API methods are usually prefixed with a word 'public' or 'private'.

Public APIs include the following:

instruments/trading pairs
price feeds (exchange rates)
order books (L1, L2, L3...)
trade history (closed orders, transactions, executions)
tickers (spot / 24h price)
OHLCV series for charting
other public endpoints

Private APIs allow the following:

manage personal account info
query account balances
trade by making market and limit orders
create deposit addresses and fund accounts
request withdrawal of fiat and crypto funds
query personal open / closed orders
query positions in margin/leverage trading
get ledger history
transfer funds between accounts
use merchant services

Unified API
The unified ccxt API is a subset of methods common among the exchanges. It currently contains the following methods:

fetchOrderBook (symbol[, limit = undefined[, params = {}]]): Fetch L2/L3 order book for a particular market trading symbol.
fetchL2OrderBook (symbol[, limit = undefined[, params]]): Level 2 (price-aggregated) order book for a particular symbol.
fetchTrades (symbol[, since[, [limit, [params]]]]): Fetch recent trades for a particular trading symbol.
fetchTicker (symbol): Fetch latest ticker data by trading symbol.


Market Data 市场行情数据

Order Book / Market Depth
Market Price
Price Tickers
Individually By Symbol
All At Once
OHLCV Candlestick Charts
Public Trades

Order Book 订单,可以获取买一卖一

gate.fetch_order_book('BTC/USDT')

{
'bids': [[6545.05, 0.5], [6544.11, 0.02], [6543.69, 0.5933], [6542.81, 0.4021], [6542.14, 0.5442], [6540.0, 2.38], [6536.27, 0.0601], [6536.25, 0.1], [6530.77, 0.461], [6530.76, 0.6], [6530.71, 0.6], [6530.44, 0.3], [6530.1, 0.0289], [6530.05, 0.2322], [6530.0, 3.2058], [6529.55, 0.265533285], [6529.1, 0.0183], [6528.72, 0.68], [6528.51, 5.0177], [6528.31, 0.007], [6527.5, 0.034], [6524.93, 1.2], [6520.0, 0.0082], [6518.63, 6.1051], [6514.9, 0.91], [6510.58, 0.4959], [6510.5, 0.138237], [6507.63, 0.76822334], [6504.44, 0.41602745], [6504.43, 7.2795]], 
'asks': [[6550.25, 0.5665], [6551.87, 0.0029], [6553.0, 7.5009], [6561.36, 0.054], [6561.37, 0.05], [6568.99, 0.0599], [6569.0, 6.4556], [6571.62, 1.2], [6572.41, 0.007], [6573.53, 0.714], [6575.41, 0.3], [6575.42, 0.9], [6576.2, 0.3], [6577.0, 0.2], [6578.0, 0.08909449], [6579.0, 0.0025], [6583.32, 1.5236206], [6584.18, 6.9668], [6586.67, 0.13], [6598.49, 8.1152], [6598.67, 0.2], [6600.0, 0.031], [6609.28, 12.0], [6610.0, 0.30119], [6612.31, 1.19257268], [6612.32, 0.21], [6617.25, 0.04], [6617.3, 0.0438], [6617.37, 0.0656], [6617.65, 0.1472]], 'timestamp': None, 'datetime': None, 'nonce': None
}

The levels of detail or levels of order book aggregation are often number-labelled like L1, L2, L3...

L1: less detail for quickly obtaining very basic info, namely, the market price only. It appears to look like just one order in the order book.
L2: most common level of aggregation where order volumes are grouped by price. If two orders have the same price, they appear as one single order for a volume equal to their total sum. This is most likely the level of aggregation you need for the majority of purposes.
L3: most detailed level with no aggregation where each order is separate from other orders. This LOD naturally contains duplicates in the output. So, if two orders have equal prices they are not merged together and it's up to the exchange's matching engine to decide on their priority in the stack. You don't really need L3 detail for successful trading. In fact, you most probably don't need it at all. Therefore some exchanges don't support it and always return aggregated order books.

Market Price

买一价:bid = orderbook['bids'][0][0] if len (orderbook['bids']) > 0 else None

卖一价:ask = orderbook['asks'][0][0] if len (orderbook['asks']) > 0 else None

差价:spread = (ask - bid) if (bid and ask) else None

时间可能缺失

orderbook['timestamp'] is the time when the exchange generated this orderbook response (before replying it back to you). This may be missing (undefined/None/null), as documented in the Manual, not all exchanges provide a timestamp there. If it is defined, then it is the UTC timestamp in milliseconds since 1 Jan 1970 00:00:00.

exchange.last_response_headers['Date'] is the date-time string of the last HTTP response received (from HTTP headers). The 'Date' parser should respect the timezone designated there. The precision of the date-time is 1 second, 1000 milliseconds. This date should be set by the exchange server when the message originated according to the following standards:

Price Tickers 行情

A price ticker contains statistics for a particular market/symbol for some period of time in recent past, usually last 24 hours. The structure of a ticker is as follows:
gate.fetch_ticker('BTC/USDT')

OHLCV Candlestick Charts 开高低收和成交量

gate.fetch_ohlcv('BTC/USDT')

Trades, Executions, Transactions 成交记录

You can call the unified fetchTrades / fetch_trades method to get the list of most recent trades for a particular symbol.
gate.fetch_trades('BTC/USDT')

[
    {
        'info':       { ... },                  // the original decoded JSON as is
        'id':        '12345-67890:09876/54321', // string trade id
        'timestamp':  1502962946216,            // Unix timestamp in milliseconds
        'datetime':  '2017-08-17 12:42:48.000', // ISO8601 datetime with milliseconds
        'symbol':    'ETH/BTC',                 // symbol
        'order':     '12345-67890:09876/54321', // string order id or undefined/None/null
        'type':      'limit',                   // order type, 'market', 'limit' or undefined/None/null
        'side':      'buy',                     // direction of the trade, 'buy' or 'sell'
        'price':      0.06917684,               // float price in quote currency
        'amount':     1.5,                      // amount of base currency
    },
    ...
]

Trading 个人交易

Proxy 代理

The python version of the library uses the python-requests package for underlying HTTP and supports all means of customization available in the requests package, including proxies.
修改环境变量

You can configure proxies by setting the environment variables HTTP_PROXY and HTTPS_PROXY.

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"

代码指定

import ccxt
exchange = ccxt.poloniex({
    'proxies': {
        'http': 'http://10.10.1.10:3128',  # these proxies won't work for you, they are here for example
        'https': 'https://10.10.1.10:1080',
    },
})

Or

import ccxt
exchange = ccxt.poloniex()
exchange.proxies = {
  'http': 'http://10.10.1.10:3128', # these proxies won't work for you, they are here for example
  'https': 'https://10.10.1.10:1080',
}

python 修改环境变量

os.environ.setdefault('http_proxy', 'http://127.0.0.1:1080')
os.environ.setdefault('https_proxy', 'http://127.0.0.1:1080')

运行日志

/Users/jinglong/.pyenv/versions/3.6.3/bin/python /Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py --multiproc --qt-support --client 127.0.0.1 --port 64765 --file /Users/jinglong/IdeaProjects/quant/ccxt/examples/py/study1.py
pydev debugger: process 72174 is connecting

Connected to pydev debugger (build 162.1237.1)
exchange list is ['binance', 'fcoin', 'gateio', 'huobipro', 'kucoin', 'okex'],
coin list is ['BTC', 'ETH', 'XRP', 'BCH', 'EOS', 'XLM', 'LTC', 'ADA', 'XMR', 'TRX', 'BNB', 'ONT', 'NEO', 'DCR'],
quote is USDT
-------start base is BTC,symbol is BTC/USDT
current symbol is BTC/USDT
exchange Binance bid1 ask1 is 
---- 6504.3,0.09579,   6504.39,0.373456,date_time is Sun, 28 Oct 2018 15:25:49 GMT
get new max_bid1 is 6504.3,exchange is Binance,date_time is Sun, 28 Oct 2018 15:25:49 GMT
get new min_ask1 is 6504.39,exchange is Binance,date_time is Sun, 28 Oct 2018 15:25:49 GMT
exchange FCoin bid1 ask1 is 
---- 6501.24,1.0497,   6504.66,0.44,date_time is Sun, 28 Oct 2018 15:25:54 GMT
exchange Gate.io bid1 ask1 is 
---- 6500.35,0.58189548,   6500.37,0.6051156,date_time is Sun, 28 Oct 2018 15:26:01 GMT
get new min_ask1 is 6500.37,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:26:01 GMT
exchange Huobi Pro bid1 ask1 is 
---- 6504.04,0.23,   6504.15,0.0041,date_time is Sun, 28 Oct 2018 15:26:06 GMT
-------XXXXXX11111 load_markets exception is kucoin https://api.kucoin.com/v1/market/open/symbols GET HTTPSConnectionPool(host='api.kucoin.com', port=443): Read timed out.,exchange is Kucoin,symbol is BTC/USDT
exchange OKEX bid1 ask1 is 
---- 6501.4374,0.06100942,   6503.0001,0.05174197,date_time is Sun, 28 Oct 2018 15:26:28 GMT


****** symbol BTC/USDT find good exchange,
 percent 0.06045809700063675%,price_diff 3.930000000000291,trade_volume 0.09579,profits 0.3764547000000279,
buy at 6500.37,0.6051156,3933.4752927719996,Gate.io,
sell at 6504.3,0.09579,623.0468970000001,Binance
(0.06045809700063675, 3.930000000000291, 0.09579, 0.3764547000000279, 6500.37, 0.6051156, 3933.4752927719996, 'Gate.io', 'Sun, 28 Oct 2018 15:26:01 GMT', 6504.3, 0.09579, 623.0468970000001, 'Binance', 'Sun, 28 Oct 2018 15:25:49 GMT')
+++++++end this symbol 



-------start base is ETH,symbol is ETH/USDT
current symbol is ETH/USDT
exchange Binance bid1 ask1 is 
---- 204.85,0.48787,   204.93,0.83001,date_time is Sun, 28 Oct 2018 15:26:30 GMT
get new max_bid1 is 204.85,exchange is Binance,date_time is Sun, 28 Oct 2018 15:26:30 GMT
get new min_ask1 is 204.93,exchange is Binance,date_time is Sun, 28 Oct 2018 15:26:30 GMT
exchange FCoin bid1 ask1 is 
---- 204.86,0.44,   205.14,23.3682,date_time is Sun, 28 Oct 2018 15:26:33 GMT
get new max_bid1 is 204.86,exchange is FCoin,date_time is Sun, 28 Oct 2018 15:26:33 GMT
exchange Gate.io bid1 ask1 is 
---- 204.68,7.3285,   204.83,9.40797228,date_time is Sun, 28 Oct 2018 15:26:37 GMT
get new min_ask1 is 204.83,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:26:37 GMT
exchange Huobi Pro bid1 ask1 is 
---- 204.78,1.2846,   204.79,10.6145,date_time is Sun, 28 Oct 2018 15:26:39 GMT
get new min_ask1 is 204.79,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:26:39 GMT
exchange Kucoin bid1 ask1 is 
---- 204.689036,1.207835,   204.904381,10.27,date_time is Sun, 28 Oct 2018 15:26:44 GMT
exchange OKEX bid1 ask1 is 
---- 204.5755,8.567972,   204.6757,0.0489,date_time is Sun, 28 Oct 2018 15:26:46 GMT
get new min_ask1 is 204.6757,exchange is OKEX,date_time is Sun, 28 Oct 2018 15:26:46 GMT


****** symbol ETH/USDT find good exchange,
 percent 0.09004488564104457%,price_diff 0.18430000000000746,trade_volume 0.0489,profits 0.009012270000000365,
buy at 204.6757,0.0489,10.00864173,OKEX,
sell at 204.86,0.44,90.1384,FCoin
(0.09004488564104457, 0.18430000000000746, 0.0489, 0.009012270000000365, 204.6757, 0.0489, 10.00864173, 'OKEX', 'Sun, 28 Oct 2018 15:26:46 GMT', 204.86, 0.44, 90.1384, 'FCoin', 'Sun, 28 Oct 2018 15:26:33 GMT')
+++++++end this symbol 



-------start base is XRP,symbol is XRP/USDT
current symbol is XRP/USDT
exchange Binance bid1 ask1 is 
---- 0.46051,2339.0,   0.46116,928.1,date_time is Sun, 28 Oct 2018 15:26:49 GMT
get new max_bid1 is 0.46051,exchange is Binance,date_time is Sun, 28 Oct 2018 15:26:49 GMT
get new min_ask1 is 0.46116,exchange is Binance,date_time is Sun, 28 Oct 2018 15:26:49 GMT
exchange FCoin bid1 ask1 is 
---- 0.4612,2391.36,   0.4614,2000.0,date_time is Sun, 28 Oct 2018 15:26:54 GMT
get new max_bid1 is 0.4612,exchange is FCoin,date_time is Sun, 28 Oct 2018 15:26:54 GMT
exchange Gate.io bid1 ask1 is 
---- 0.4605,1935.6159,   0.4614,7736.323,date_time is Sun, 28 Oct 2018 15:26:57 GMT
exchange Huobi Pro bid1 ask1 is 
---- 0.4607,2104.58,   0.461,600.0,date_time is Sun, 28 Oct 2018 15:26:59 GMT
get new min_ask1 is 0.461,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:26:59 GMT
-------XXXXXX22222 fetch_order_book exception is kucoin No market symbol XRP/USDT,exchange is Kucoin,symbol is XRP/USDT
exchange OKEX bid1 ask1 is 
---- 0.4607,961.448,   0.4612,2555.073,date_time is Sun, 28 Oct 2018 15:27:02 GMT


****** symbol XRP/USDT find good exchange,
 percent 0.04338394793925769%,price_diff 0.00019999999999997797,trade_volume 600.0,profits 0.11999999999998678,
buy at 0.461,600.0,276.6,Huobi Pro,
sell at 0.4612,2391.36,1102.895232,FCoin
(0.04338394793925769, 0.00019999999999997797, 600.0, 0.11999999999998678, 0.461, 600.0, 276.6, 'Huobi Pro', 'Sun, 28 Oct 2018 15:26:59 GMT', 0.4612, 2391.36, 1102.895232, 'FCoin', 'Sun, 28 Oct 2018 15:26:54 GMT')
+++++++end this symbol 



-------start base is BCH,symbol is BCH/USDT
current symbol is BCH/USDT
exchange Binance bid1 ask1 is 
---- 440.17,0.00079,   440.36,0.642,date_time is Sun, 28 Oct 2018 15:27:04 GMT
get new max_bid1 is 440.17,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:04 GMT
get new min_ask1 is 440.36,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:04 GMT
exchange FCoin bid1 ask1 is 
---- 439.59,5.0055,   440.17,0.44,date_time is Sun, 28 Oct 2018 15:27:07 GMT
get new min_ask1 is 440.17,exchange is FCoin,date_time is Sun, 28 Oct 2018 15:27:07 GMT
exchange Gate.io bid1 ask1 is 
---- 440.68,0.01,   441.04,5.0,date_time is Sun, 28 Oct 2018 15:27:09 GMT
get new max_bid1 is 440.68,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:27:09 GMT
exchange Huobi Pro bid1 ask1 is 
---- 439.92,0.6597,   439.99,4.0,date_time is Sun, 28 Oct 2018 15:27:12 GMT
get new min_ask1 is 439.99,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:27:12 GMT
exchange Kucoin bid1 ask1 is 
---- 438.782616,14.32,   440.537748,13.64,date_time is Sun, 28 Oct 2018 15:27:14 GMT
exchange OKEX bid1 ask1 is 
---- 439.8009,0.511,   440.2082,3.0,date_time is Sun, 28 Oct 2018 15:27:17 GMT


****** symbol BCH/USDT find good exchange,
 percent 0.15682174594877105%,price_diff 0.6899999999999977,trade_volume 0.01,profits 0.006899999999999978,
buy at 439.99,4.0,1759.96,Huobi Pro,
sell at 440.68,0.01,4.4068000000000005,Gate.io
(0.15682174594877105, 0.6899999999999977, 0.01, 0.006899999999999978, 439.99, 4.0, 1759.96, 'Huobi Pro', 'Sun, 28 Oct 2018 15:27:12 GMT', 440.68, 0.01, 4.4068000000000005, 'Gate.io', 'Sun, 28 Oct 2018 15:27:09 GMT')
+++++++end this symbol 



-------start base is EOS,symbol is EOS/USDT
current symbol is EOS/USDT
exchange Binance bid1 ask1 is 
---- 5.4222,3.68,   5.4285,81.89,date_time is Sun, 28 Oct 2018 15:27:19 GMT
get new max_bid1 is 5.4222,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:19 GMT
get new min_ask1 is 5.4285,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:19 GMT
exchange FCoin bid1 ask1 is 
---- 5.412,1.0,   5.4143,691.6249,date_time is Sun, 28 Oct 2018 15:27:22 GMT
get new min_ask1 is 5.4143,exchange is FCoin,date_time is Sun, 28 Oct 2018 15:27:22 GMT
exchange Gate.io bid1 ask1 is 
---- 5.4264,9.083,   5.4327,257.297,date_time is Sun, 28 Oct 2018 15:27:24 GMT
get new max_bid1 is 5.4264,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:27:24 GMT
exchange Huobi Pro bid1 ask1 is 
---- 5.4233,30.5441,   5.4264,166.06,date_time is Sun, 28 Oct 2018 15:27:26 GMT
exchange Kucoin bid1 ask1 is 
---- 5.416922,19.0,   5.43343,4.4235,date_time is Sun, 28 Oct 2018 15:27:29 GMT
exchange OKEX bid1 ask1 is 
---- 5.4227,54.6,   5.4258,52.6,date_time is Sun, 28 Oct 2018 15:27:31 GMT


****** symbol EOS/USDT find good exchange,
 percent 0.22348225994127074%,price_diff 0.012100000000000222,trade_volume 9.083,profits 0.10990430000000201,
buy at 5.4143,691.6249,3744.66469607,FCoin,
sell at 5.4264,9.083,49.2879912,Gate.io
(0.22348225994127074, 0.012100000000000222, 9.083, 0.10990430000000201, 5.4143, 691.6249, 3744.66469607, 'FCoin', 'Sun, 28 Oct 2018 15:27:22 GMT', 5.4264, 9.083, 49.2879912, 'Gate.io', 'Sun, 28 Oct 2018 15:27:24 GMT')
+++++++end this symbol 



-------start base is XLM,symbol is XLM/USDT
current symbol is XLM/USDT
exchange Binance bid1 ask1 is 
---- 0.23673,3037.4,   0.23707,85.9,date_time is Sun, 28 Oct 2018 15:27:34 GMT
get new max_bid1 is 0.23673,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:34 GMT
get new min_ask1 is 0.23707,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:34 GMT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol XLM/USDT,exchange is FCoin,symbol is XLM/USDT
exchange Gate.io bid1 ask1 is 
---- 0.2366,5154.23270757,   0.2375,4.416773425,date_time is Sun, 28 Oct 2018 15:27:42 GMT
exchange Huobi Pro bid1 ask1 is 
---- 0.236704,490.0,   0.237871,4.9001,date_time is Sun, 28 Oct 2018 15:27:46 GMT
exchange Kucoin bid1 ask1 is 
---- 0.235367,133.7694,   0.23699,10.7614,date_time is Sun, 28 Oct 2018 15:27:49 GMT
get new min_ask1 is 0.23699,exchange is Kucoin,date_time is Sun, 28 Oct 2018 15:27:49 GMT
exchange OKEX bid1 ask1 is 
---- 0.2369,4681.057,   0.2377,60.696,date_time is Sun, 28 Oct 2018 15:27:52 GMT
get new max_bid1 is 0.2369,exchange is OKEX,date_time is Sun, 28 Oct 2018 15:27:52 GMT


****** symbol XLM/USDT find good exchange,
 percent -0.03797628591923994%,price_diff -9.000000000000674e-05,trade_volume 10.7614,profits -0.0009685260000000726,
buy at 0.23699,10.7614,2.5503441860000002,Kucoin,
sell at 0.2369,4681.057,1108.9424033,OKEX
oooooooo unlucky symbol XLM/USDT,no pair to make money
(-0.03797628591923994, -9.000000000000674e-05, 10.7614, -0.0009685260000000726, 0.23699, 10.7614, 2.5503441860000002, 'Kucoin', 'Sun, 28 Oct 2018 15:27:49 GMT', 0.2369, 4681.057, 1108.9424033, 'OKEX', 'Sun, 28 Oct 2018 15:27:52 GMT')
+++++++end this symbol 



-------start base is LTC,symbol is LTC/USDT
current symbol is LTC/USDT
exchange Binance bid1 ask1 is 
---- 52.13,21.77757,   52.2,4.41653,date_time is Sun, 28 Oct 2018 15:27:55 GMT
get new max_bid1 is 52.13,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:55 GMT
get new min_ask1 is 52.2,exchange is Binance,date_time is Sun, 28 Oct 2018 15:27:55 GMT
exchange FCoin bid1 ask1 is 
---- 52.11,14.3584,   52.23,10.0,date_time is Sun, 28 Oct 2018 15:28:00 GMT
exchange Gate.io bid1 ask1 is 
---- 52.12,8.56,   52.31,11.0,date_time is Sun, 28 Oct 2018 15:28:06 GMT
exchange Huobi Pro bid1 ask1 is 
---- 52.14,5.096,   52.15,28.504995877277086,date_time is Sun, 28 Oct 2018 15:28:08 GMT
get new max_bid1 is 52.14,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:28:08 GMT
get new min_ask1 is 52.15,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:28:08 GMT
exchange Kucoin bid1 ask1 is 
---- 51.990572,65.163497,   52.378972,18.257215,date_time is Sun, 28 Oct 2018 15:28:11 GMT
exchange OKEX bid1 ask1 is 
---- 52.1485,0.03,   52.1869,1.999,date_time is Sun, 28 Oct 2018 15:28:13 GMT
get new max_bid1 is 52.1485,exchange is OKEX,date_time is Sun, 28 Oct 2018 15:28:13 GMT


****** symbol LTC/USDT find good exchange,
 percent -0.0028763183125600326%,price_diff -0.0015000000000000568,trade_volume 0.03,profits -4.500000000000172e-05,
buy at 52.15,28.504995877277086,1486.535535,Huobi Pro,
sell at 52.1485,0.03,1.564455,OKEX
oooooooo unlucky symbol LTC/USDT,no pair to make money
(-0.0028763183125600326, -0.0015000000000000568, 0.03, -4.500000000000172e-05, 52.15, 28.504995877277086, 1486.535535, 'Huobi Pro', 'Sun, 28 Oct 2018 15:28:08 GMT', 52.1485, 0.03, 1.564455, 'OKEX', 'Sun, 28 Oct 2018 15:28:13 GMT')
+++++++end this symbol 



-------start base is ADA,symbol is ADA/USDT
current symbol is ADA/USDT
exchange Binance bid1 ask1 is 
---- 0.07318,7297.7,   0.07326,1671.8,date_time is Sun, 28 Oct 2018 15:28:15 GMT
get new max_bid1 is 0.07318,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:15 GMT
get new min_ask1 is 0.07326,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:15 GMT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol ADA/USDT,exchange is FCoin,symbol is ADA/USDT
exchange Gate.io bid1 ask1 is 
---- 0.0733,5486.87197967,   0.0735,43209.07116508,date_time is Sun, 28 Oct 2018 15:28:20 GMT
get new max_bid1 is 0.0733,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:28:20 GMT
exchange Huobi Pro bid1 ask1 is 
---- 0.073124,8135.2624,   0.073287,8958.4492,date_time is Sun, 28 Oct 2018 15:28:22 GMT
-------XXXXXX22222 fetch_order_book exception is kucoin No market symbol ADA/USDT,exchange is Kucoin,symbol is ADA/USDT
exchange OKEX bid1 ask1 is 
---- 0.0732,2099.5,   0.0734,10468.05026171,date_time is Sun, 28 Oct 2018 15:28:25 GMT


****** symbol ADA/USDT find good exchange,
 percent 0.05460005460005237%,price_diff 3.999999999999837e-05,trade_volume 1671.8,profits 0.06687199999999728,
buy at 0.07326,1671.8,122.47606800000001,Binance,
sell at 0.0733,5486.87197967,402.187716109811,Gate.io
(0.05460005460005237, 3.999999999999837e-05, 1671.8, 0.06687199999999728, 0.07326, 1671.8, 122.47606800000001, 'Binance', 'Sun, 28 Oct 2018 15:28:15 GMT', 0.0733, 5486.87197967, 402.187716109811, 'Gate.io', 'Sun, 28 Oct 2018 15:28:20 GMT')
+++++++end this symbol 



-------start base is XMR,symbol is XMR/USDT
current symbol is XMR/USDT
-------XXXXXX22222 fetch_order_book exception is binance No market symbol XMR/USDT,exchange is Binance,symbol is XMR/USDT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol XMR/USDT,exchange is FCoin,symbol is XMR/USDT
exchange Gate.io bid1 ask1 is 
---- 102.31,0.5639,   103.02,88.3754,date_time is Sun, 28 Oct 2018 15:28:27 GMT
get new max_bid1 is 102.31,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:28:27 GMT
get new min_ask1 is 103.02,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:28:27 GMT
-------XXXXXX22222 fetch_order_book exception is huobipro No market symbol XMR/USDT,exchange is Huobi Pro,symbol is XMR/USDT
-------XXXXXX22222 fetch_order_book exception is kucoin No market symbol XMR/USDT,exchange is Kucoin,symbol is XMR/USDT
exchange OKEX bid1 ask1 is 
---- 100.7457,0.113239,   101.1208,3.012,date_time is Sun, 28 Oct 2018 15:28:30 GMT
get new min_ask1 is 101.1208,exchange is OKEX,date_time is Sun, 28 Oct 2018 15:28:30 GMT


****** symbol XMR/USDT find good exchange,
 percent 1.1760191770634723%,price_diff 1.1891999999999996,trade_volume 0.5639,profits 0.6705898799999997,
buy at 101.1208,3.012,304.5758496,OKEX,
sell at 102.31,0.5639,57.692609,Gate.io
(1.1760191770634723, 1.1891999999999996, 0.5639, 0.6705898799999997, 101.1208, 3.012, 304.5758496, 'OKEX', 'Sun, 28 Oct 2018 15:28:30 GMT', 102.31, 0.5639, 57.692609, 'Gate.io', 'Sun, 28 Oct 2018 15:28:27 GMT')
+++++++end this symbol 



-------start base is TRX,symbol is TRX/USDT
current symbol is TRX/USDT
exchange Binance bid1 ask1 is 
---- 0.02346,11914.8,   0.02349,11054.2,date_time is Sun, 28 Oct 2018 15:28:32 GMT
get new max_bid1 is 0.02346,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:32 GMT
get new min_ask1 is 0.02349,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:32 GMT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol TRX/USDT,exchange is FCoin,symbol is TRX/USDT
exchange Gate.io bid1 ask1 is 
---- 0.02344,53744.32,   0.0235,80.84877907,date_time is Sun, 28 Oct 2018 15:28:37 GMT
exchange Huobi Pro bid1 ask1 is 
---- 0.023444,215535.0,   0.023461,61661.3,date_time is Sun, 28 Oct 2018 15:28:40 GMT
get new min_ask1 is 0.023461,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:28:40 GMT
exchange Kucoin bid1 ask1 is 
---- 0.023372,44505.2076,   0.023696,2125.6434,date_time is Sun, 28 Oct 2018 15:28:42 GMT
exchange OKEX bid1 ask1 is 
---- 0.023442,43446.28,   0.023484,1958.92,date_time is Sun, 28 Oct 2018 15:28:44 GMT


****** symbol TRX/USDT find good exchange,
 percent -0.004262392907367677%,price_diff -9.999999999975306e-07,trade_volume 11914.8,profits -0.011914799999970577,
buy at 0.023461,61661.3,1446.6357593,Huobi Pro,
sell at 0.02346,11914.8,279.521208,Binance
oooooooo unlucky symbol TRX/USDT,no pair to make money
(-0.004262392907367677, -9.999999999975306e-07, 11914.8, -0.011914799999970577, 0.023461, 61661.3, 1446.6357593, 'Huobi Pro', 'Sun, 28 Oct 2018 15:28:40 GMT', 0.02346, 11914.8, 279.521208, 'Binance', 'Sun, 28 Oct 2018 15:28:32 GMT')
+++++++end this symbol 



-------start base is BNB,symbol is BNB/USDT
current symbol is BNB/USDT
exchange Binance bid1 ask1 is 
---- 9.69,7.22,   9.6995,199.02,date_time is Sun, 28 Oct 2018 15:28:48 GMT
get new max_bid1 is 9.69,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:48 GMT
get new min_ask1 is 9.6995,exchange is Binance,date_time is Sun, 28 Oct 2018 15:28:48 GMT
exchange FCoin bid1 ask1 is 
---- 9.6655,31.0,   9.6945,0.22,date_time is Sun, 28 Oct 2018 15:28:54 GMT
get new min_ask1 is 9.6945,exchange is FCoin,date_time is Sun, 28 Oct 2018 15:28:54 GMT
exchange Gate.io bid1 ask1 is 
---- 9.6389,57.8864,   9.7356,0.0007,date_time is Sun, 28 Oct 2018 15:28:57 GMT
-------XXXXXX22222 fetch_order_book exception is huobipro No market symbol BNB/USDT,exchange is Huobi Pro,symbol is BNB/USDT
-------XXXXXX22222 fetch_order_book exception is kucoin No market symbol BNB/USDT,exchange is Kucoin,symbol is BNB/USDT
-------XXXXXX22222 fetch_order_book exception is okex No market symbol BNB/USDT,exchange is OKEX,symbol is BNB/USDT


****** symbol BNB/USDT find good exchange,
 percent -0.046418072102740425%,price_diff -0.0045000000000001705,trade_volume 0.22,profits -0.0009900000000000375,
buy at 9.6945,0.22,2.13279,FCoin,
sell at 9.69,7.22,69.9618,Binance
oooooooo unlucky symbol BNB/USDT,no pair to make money
(-0.046418072102740425, -0.0045000000000001705, 0.22, -0.0009900000000000375, 9.6945, 0.22, 2.13279, 'FCoin', 'Sun, 28 Oct 2018 15:28:54 GMT', 9.69, 7.22, 69.9618, 'Binance', 'Sun, 28 Oct 2018 15:28:48 GMT')
+++++++end this symbol 



-------start base is ONT,symbol is ONT/USDT
current symbol is ONT/USDT
-------XXXXXX22222 fetch_order_book exception is binance GET https://api.binance.com/api/v1/depth?symbol=ONTUSDT HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10),exchange is Binance,symbol is ONT/USDT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol ONT/USDT,exchange is FCoin,symbol is ONT/USDT
exchange Gate.io bid1 ask1 is 
---- 1.732,679.771,   1.736,5012.69153,date_time is Sun, 28 Oct 2018 15:29:10 GMT
get new max_bid1 is 1.732,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:29:10 GMT
get new min_ask1 is 1.736,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:29:10 GMT
exchange Huobi Pro bid1 ask1 is 
---- 1.7374,558.2275,   1.7399,4.8,date_time is Sun, 28 Oct 2018 15:29:12 GMT
get new max_bid1 is 1.7374,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:29:12 GMT
exchange Kucoin bid1 ask1 is 
---- 1.721871,286.537,   1.74528,5.9251,date_time is Sun, 28 Oct 2018 15:29:15 GMT
exchange OKEX bid1 ask1 is 
---- 1.7369,592.081,   1.7406,177.0,date_time is Sun, 28 Oct 2018 15:29:17 GMT


****** symbol ONT/USDT find good exchange,
 percent 0.08064516129032649%,price_diff 0.0014000000000000679,trade_volume 558.2275,profits 0.7815185000000378,
buy at 1.736,5012.69153,8702.03249608,Gate.io,
sell at 1.7374,558.2275,969.8644585,Huobi Pro
(0.08064516129032649, 0.0014000000000000679, 558.2275, 0.7815185000000378, 1.736, 5012.69153, 8702.03249608, 'Gate.io', 'Sun, 28 Oct 2018 15:29:10 GMT', 1.7374, 558.2275, 969.8644585, 'Huobi Pro', 'Sun, 28 Oct 2018 15:29:12 GMT')
+++++++end this symbol 



-------start base is NEO,symbol is NEO/USDT
current symbol is NEO/USDT
exchange Binance bid1 ask1 is 
---- 16.201,70.0,   16.214,13.567,date_time is Sun, 28 Oct 2018 15:29:21 GMT
get new max_bid1 is 16.201,exchange is Binance,date_time is Sun, 28 Oct 2018 15:29:21 GMT
get new min_ask1 is 16.214,exchange is Binance,date_time is Sun, 28 Oct 2018 15:29:21 GMT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol NEO/USDT,exchange is FCoin,symbol is NEO/USDT
exchange Gate.io bid1 ask1 is 
---- 16.16,35.49521308,   16.26,20.61452399,date_time is Sun, 28 Oct 2018 15:29:24 GMT
exchange Huobi Pro bid1 ask1 is 
---- 16.21,3.9923,   16.23,283.243,date_time is Sun, 28 Oct 2018 15:29:26 GMT
get new max_bid1 is 16.21,exchange is Huobi Pro,date_time is Sun, 28 Oct 2018 15:29:26 GMT
exchange Kucoin bid1 ask1 is 
---- 16.155601,35.72,   16.2411,1.33,date_time is Sun, 28 Oct 2018 15:29:29 GMT
exchange OKEX bid1 ask1 is 
---- 16.1824,62.948,   16.2464,23.87956,date_time is Sun, 28 Oct 2018 15:29:31 GMT


****** symbol NEO/USDT find good exchange,
 percent -0.0246700382385456%,price_diff -0.003999999999997783,trade_volume 3.9923,profits -0.015969199999991152,
buy at 16.214,13.567,219.975338,Binance,
sell at 16.21,3.9923,64.71518300000001,Huobi Pro
oooooooo unlucky symbol NEO/USDT,no pair to make money
(-0.0246700382385456, -0.003999999999997783, 3.9923, -0.015969199999991152, 16.214, 13.567, 219.975338, 'Binance', 'Sun, 28 Oct 2018 15:29:21 GMT', 16.21, 3.9923, 64.71518300000001, 'Huobi Pro', 'Sun, 28 Oct 2018 15:29:26 GMT')
+++++++end this symbol 



-------start base is DCR,symbol is DCR/USDT
current symbol is DCR/USDT
-------XXXXXX22222 fetch_order_book exception is binance No market symbol DCR/USDT,exchange is Binance,symbol is DCR/USDT
-------XXXXXX22222 fetch_order_book exception is fcoin No market symbol DCR/USDT,exchange is FCoin,symbol is DCR/USDT
exchange Gate.io bid1 ask1 is 
---- 44.12,0.67996374,   46.425,0.33915918,date_time is Sun, 28 Oct 2018 15:29:34 GMT
get new max_bid1 is 44.12,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:29:34 GMT
get new min_ask1 is 46.425,exchange is Gate.io,date_time is Sun, 28 Oct 2018 15:29:34 GMT
-------XXXXXX22222 fetch_order_book exception is huobipro No market symbol DCR/USDT,exchange is Huobi Pro,symbol is DCR/USDT
-------XXXXXX22222 fetch_order_book exception is kucoin No market symbol DCR/USDT,exchange is Kucoin,symbol is DCR/USDT
exchange OKEX bid1 ask1 is 
---- 45.5927,1.1,   47.7912,15.67663741,date_time is Sun, 28 Oct 2018 15:29:36 GMT
get new max_bid1 is 45.5927,exchange is OKEX,date_time is Sun, 28 Oct 2018 15:29:36 GMT


****** symbol DCR/USDT find good exchange,
 percent -1.7927840603123242%,price_diff -0.8322999999999965,trade_volume 0.33915918,profits -0.2822821855139988,
buy at 46.425,0.33915918,15.745464931499999,Gate.io,
sell at 45.5927,1.1,50.151970000000006,OKEX
oooooooo unlucky symbol DCR/USDT,no pair to make money
(-1.7927840603123242, -0.8322999999999965, 0.33915918, -0.2822821855139988, 46.425, 0.33915918, 15.745464931499999, 'Gate.io', 'Sun, 28 Oct 2018 15:29:34 GMT', 45.5927, 1.1, 50.151970000000006, 'OKEX', 'Sun, 28 Oct 2018 15:29:36 GMT')
+++++++end this symbol 



-----------all over---------------

Process finished with exit code 0


相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...