コード例 #1
0
ファイル: demo.py プロジェクト: halida/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(
        GDAX(pairs=['BTC-USD'],
             channels=[TICKER, TRADES],
             callbacks={
                 TICKER: TickerCallback(ticker),
                 TRADES: TradeCallback(trade)
             }))
    f.add_feed(
        GDAX(pairs=['BTC-USD'],
             channels=[L3_BOOK],
             callbacks={L3_BOOK: BookCallback(book)}))
    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[L3_BOOK],
                 callbacks={L3_BOOK: BookCallback(book)}))
    f.add_feed(
        Poloniex(channels=[TICKER, 'USDT-BTC'],
                 callbacks={
                     L3_BOOK: BookCallback(book),
                     TICKER: TickerCallback(ticker)
                 }))
    f.add_feed(
        Gemini(pairs=['BTC-USD'],
               callbacks={
                   L3_BOOK: BookCallback(book),
                   TRADES: TradeCallback(trade)
               }))
    f.add_feed(
        HitBTC(channels=[TRADES],
               pairs=['BTC-USD'],
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Bitstamp(channels=[L3_BOOK, TRADES],
                 pairs=['BTC-USD'],
                 callbacks={
                     L3_BOOK: BookCallback(book),
                     TRADES: TradeCallback(trade)
                 }))

    bitmex_symbols = Bitmex.get_active_symbols()
    f.add_feed(
        Bitmex(channels=[TRADES],
               pairs=bitmex_symbols,
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[L2_BOOK],
               callbacks={L2_BOOK: BookCallback(book)}))
    f.run()
コード例 #2
0
ファイル: demo_influxdb.py プロジェクト: ray-sg/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(Bitmex(channels=[FUNDING, L3_BOOK], pairs=['XBTUSD'], callbacks={FUNDING: FundingInflux('http://localhost:8086', 'example'), L3_BOOK: BookInflux('http://localhost:8086', 'example', depth=10)}))
    f.add_feed(Coinbase(channels=[TRADES], pairs=['BTC-USD'], callbacks={TRADES: TradeInflux('http://localhost:8086', 'example')}))
    f.add_feed(Coinbase(channels=[L2_BOOK], pairs=['BTC-USD'], callbacks={L2_BOOK: BookInflux('http://localhost:8086', 'example', depth=10)}))

    f.run()
コード例 #3
0
def main():
    f = FeedHandler()
    f.add_feed(Bitmex(channels=[TRADES, FUNDING], pairs=['XBTUSD'], callbacks={TRADES: TradeRedis(), FUNDING: FundingRedis()}))
    f.add_feed(Bitfinex(channels=[TRADES], pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))
    f.add_feed(GDAX(channels=[TRADES], pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))
    f.add_feed(Gemini(pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))

    f.run()
コード例 #4
0
ファイル: demo_redis.py プロジェクト: ray-sg/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(Bitmex(channels=[TRADES, FUNDING], pairs=['XBTUSD'], callbacks={TRADES: TradeRedis(), FUNDING: FundingRedis()}))
    f.add_feed(Bitfinex(channels=[TRADES], pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))
    f.add_feed(Coinbase(channels=[TRADES], pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))
    f.add_feed(Coinbase(channels=[L2_BOOK], pairs=['BTC-USD'], callbacks={L2_BOOK: BookRedis(depth=10)}))
    f.add_feed(Gemini(pairs=['BTC-USD'], callbacks={TRADES: TradeRedis()}))

    f.run()
コード例 #5
0
ファイル: demo_book_delta.py プロジェクト: sfkiwi/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[L2_BOOK],
               callbacks={
                   L2_BOOK: BookCallback(book),
                   BOOK_DELTA: BookUpdateCallback(delta)
               }))
    f.run()
コード例 #6
0
ファイル: demo_arctic.py プロジェクト: ray-sg/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(
        Bitmex(channels=[TRADES, FUNDING],
               pairs=['XBTUSD'],
               callbacks={
                   TRADES: TradeArctic('cryptofeed-test'),
                   FUNDING: FundingArctic('cryptofeed-test')
               }))
    f.add_feed(
        Bitfinex(channels=[TRADES],
                 pairs=['BTC-USD'],
                 callbacks={TRADES: TradeArctic('cryptofeed-test')}))

    f.run()
コード例 #7
0
ファイル: demo.py プロジェクト: hdulqs/cryptofeed
def main():
    f = FeedHandler()
    f.add_feed(COINBASE,
               pairs=['BTC-USD'],
               channels=[TICKER],
               callbacks={TICKER: TickerCallback(ticker)})
    f.add_feed(
        Coinbase(pairs=['BTC-USD'],
                 channels=[TRADES],
                 callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Coinbase(pairs=['BTC-USD'],
                 channels=[L2_BOOK],
                 callbacks={L2_BOOK: BookCallback(book)}))
    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[L2_BOOK],
                 callbacks={L2_BOOK: BookCallback(book)}))
    f.add_feed(
        Poloniex(channels=['USDT-BTC', 'USDC-BTC'],
                 callbacks={
                     L2_BOOK: BookCallback(book),
                     TICKER: TickerCallback(ticker)
                 }))
    f.add_feed(
        Poloniex(channels=['USDT-BTC', 'USDC-BTC'],
                 callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Gemini(pairs=['BTC-USD'],
               callbacks={
                   L2_BOOK: BookCallback(book),
                   TRADES: TradeCallback(trade)
               }))
    f.add_feed(
        HitBTC(channels=[TRADES],
               pairs=['BTC-USD'],
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        HitBTC(channels=[L2_BOOK],
               pairs=['BTC-USD'],
               callbacks={L2_BOOK: BookCallback(book)}))
    f.add_feed(
        Bitstamp(channels=[L2_BOOK, TRADES],
                 pairs=['BTC-USD'],
                 callbacks={
                     L2_BOOK: BookCallback(book),
                     TRADES: TradeCallback(trade)
                 }))

    bitmex_symbols = Bitmex.get_active_symbols()
    f.add_feed(
        Bitmex(channels=[TRADES],
               pairs=bitmex_symbols,
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[FUNDING, TRADES],
               callbacks={
                   FUNDING: FundingCallback(funding),
                   TRADES: TradeCallback(trade)
               }))
    f.add_feed(
        Bitfinex(pairs=['BTC'],
                 channels=[FUNDING],
                 callbacks={FUNDING: FundingCallback(funding)}))
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[L3_BOOK],
               callbacks={L3_BOOK: BookCallback(book)}))
    f.run()
コード例 #8
0
def main():

    f = FeedHandler()
    #BitFinex
    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[L2_BOOK, TICKER],
                 callbacks={
                     L2_BOOK: BookCallback(book),
                     TICKER: TickerCallback(ticker)
                 }))
    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[TRADES],
                 callbacks={TRADES: TradeCallback(trade)}))
    f.add_nbbo([Bitfinex, Gemini, HitBTC, Bitstamp], ['BTC-USD'], nbbo_ticker)
    f.add_feed(
        Poloniex(channels=['USDT-BTC', 'USDC-BTC'],
                 callbacks={TICKER: TickerCallback(ticker)}))
    f.add_feed(
        Poloniex(channels=['USDT-BTC', 'USDC-BTC'],
                 callbacks={L2_BOOK: BookCallback(book)}))
    f.add_feed(
        Poloniex(channels=['USDT-BTC', 'USDC-BTC'],
                 callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Gemini(pairs=['BTC-USD'],
               callbacks={
                   L2_BOOK: BookCallback(book),
                   TRADES: TradeCallback(trade)
               }))
    f.add_feed(
        HitBTC(channels=[TRADES],
               pairs=['BTC-USD'],
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        HitBTC(channels=[L2_BOOK],
               pairs=['BTC-USD'],
               callbacks={L2_BOOK: BookCallback(book)}))
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[TRADES],
               callbacks={TRADES: TradeCallback(trade)}))
    f.add_feed(
        Bitmex(pairs=['XBTUSD'],
               channels=[L3_BOOK],
               callbacks={L3_BOOK: BookCallback(book)}))
    f.add_feed(
        Bitstamp(channels=[L2_BOOK, TRADES],
                 pairs=['BTC-USD'],
                 callbacks={
                     L2_BOOK: BookCallback(book),
                     TRADES: TradeCallback(trade)
                 }))
    #f.add_nbbo([Bitfinex, Gemini], ['BTC-USD'], nbbo_ticker)

    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[TICKER],
                 callbacks={TICKER: TickerCallback(ticker)}))
    f.add_feed(
        Gemini(pairs=['BTC-USD'], callbacks={TICKER: TickerCallback(ticker)}))
    f.add_feed(
        HitBTC(pairs=['BTC-USD'],
               channels=[TICKER],
               callbacks={TICKER: TickerCallback(ticker)}))
    #f.add_feed(Bitmex(Bitstamp=['BTC-USD'], channels=[TICKER], callbacks={TICKER: TickerCallback(ticker)}))
    f.run()