Exemple #1
0
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_UPDATE, L3_BOOK],
             callbacks={
                 L3_BOOK: L3BookCallback(l3book),
                 L3_BOOK_UPDATE: L3BookUpdateCallback(l3bookupdate)
             },
             intervals={'_book_snapshot': 3}))
    f.add_feed(
        Bitfinex(pairs=['BTC-USD'],
                 channels=[L3_BOOK],
                 callbacks={L3_BOOK: L3BookCallback(l3book)}))
    f.add_feed(
        Poloniex(channels=[TICKER, 'USDT-BTC'],
                 callbacks={
                     L3_BOOK_UPDATE: L3BookUpdateCallback(l3bookupdate),
                     L3_BOOK: L3BookCallback(l3book),
                     TICKER: TickerCallback(ticker)
                 }))
    f.add_feed(
        Gemini(pairs=['BTC-USD'],
               channels=[L3_BOOK],
               callbacks={
                   L3_BOOK_UPDATE: L3BookUpdateCallback(l3bookupdate),
                   L3_BOOK: L3BookCallback(l3book),
                   TRADES: TradeCallback(trade)
               },
               intervals={'_book_snapshot': 3}))
    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: L3BookCallback(l3book),
                     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()
Exemple #2
0
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=[FUNDING, TRADES], callbacks={FUNDING: FundingCallback(funding), TRADES: TradeCallback(trade)}))
    f.add_feed(Bitfinex(pairs=['fBTC'], channels=[FUNDING], callbacks={FUNDING: FundingCallback(funding)}))
    f.run()