forked from ranaroussi/cryptex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
38 lines (25 loc) · 734 Bytes
/
test.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import signal
import multitasking
from cryptex.blotter import Blotter
multitasking.set_engine("process")
signal.signal(signal.SIGINT, multitasking.killall)
@multitasking.task
def on_orderbook(df_bids, df_asks, **kwargs):
# print(df_bids, df_asks)
pass
@multitasking.task
def on_tick(df, **kwargs):
# print(df)
pass
@multitasking.task
def on_bar(df, **kwargs):
# print(df)
pass
if __name__ == '__main__':
handler = Blotter(market="binance",
bar_handler=on_bar,
tick_handler=on_tick,
book_handler=on_orderbook)
handler.stream(base="ETH", quote="BTC", freq='3S', orderbook=True)