Post @goodboy review commit
parent
169420b5f3
commit
a0dfdd935f
|
@ -63,14 +63,17 @@ _ohlc_dtype = [
|
||||||
('low', float),
|
('low', float),
|
||||||
('close', float),
|
('close', float),
|
||||||
('volume', float),
|
('volume', float),
|
||||||
# XXX: don't need these in shm history right?
|
('bar_wap', float), # will be zeroed by sampler if not filled
|
||||||
|
|
||||||
|
# XXX: some additional fields are defined in the docs:
|
||||||
|
# https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
||||||
|
|
||||||
# ('close_time', int),
|
# ('close_time', int),
|
||||||
# ('quote_vol', float),
|
# ('quote_vol', float),
|
||||||
# ('num_trades', int),
|
# ('num_trades', int),
|
||||||
# ('buy_base_vol', float),
|
# ('buy_base_vol', float),
|
||||||
# ('buy_quote_vol', float),
|
# ('buy_quote_vol', float),
|
||||||
# ('ignore', float),
|
# ('ignore', float),
|
||||||
('bar_wap', float), # will be zeroed by sampler if not filled
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# UI components allow this to be declared such that additional
|
# UI components allow this to be declared such that additional
|
||||||
|
@ -106,7 +109,6 @@ class Pair(BaseModel):
|
||||||
permissions: List[str]
|
permissions: List[str]
|
||||||
|
|
||||||
|
|
||||||
# TODO: this isn't being used yet right?
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class OHLC:
|
class OHLC:
|
||||||
"""Description of the flattened OHLC quote format.
|
"""Description of the flattened OHLC quote format.
|
||||||
|
@ -114,26 +116,6 @@ class OHLC:
|
||||||
For schema details see:
|
For schema details see:
|
||||||
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams
|
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams
|
||||||
|
|
||||||
documented format:
|
|
||||||
```
|
|
||||||
[
|
|
||||||
[
|
|
||||||
1499040000000, // Open time
|
|
||||||
"0.01634790", // Open
|
|
||||||
"0.80000000", // High
|
|
||||||
"0.01575800", // Low
|
|
||||||
"0.01577100", // Close
|
|
||||||
"148976.11427815", // Volume
|
|
||||||
1499644799999, // Close time
|
|
||||||
"2434.19055334", // Quote asset volume
|
|
||||||
308, // Number of trades
|
|
||||||
"1756.87402397", // Taker buy base asset volume
|
|
||||||
"28.46694368", // Taker buy quote asset volume
|
|
||||||
"17928899.62484339" // Ignore.
|
|
||||||
]
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
time: int
|
time: int
|
||||||
|
|
||||||
|
@ -155,9 +137,6 @@ class OHLC:
|
||||||
# figure out what to extract for this.
|
# figure out what to extract for this.
|
||||||
bar_wap: float = 0.0
|
bar_wap: float = 0.0
|
||||||
|
|
||||||
# (sampled) generated tick data
|
|
||||||
# ticks: List[Any] = field(default_factory=list)
|
|
||||||
|
|
||||||
|
|
||||||
# convert arrow timestamp to unixtime in miliseconds
|
# convert arrow timestamp to unixtime in miliseconds
|
||||||
def binance_timestamp(when):
|
def binance_timestamp(when):
|
||||||
|
@ -263,17 +242,17 @@ async def get_client() -> Client:
|
||||||
|
|
||||||
# validation type
|
# validation type
|
||||||
class AggTrade(BaseModel):
|
class AggTrade(BaseModel):
|
||||||
e: str # "aggTrade", # Event type
|
e: str # Event type
|
||||||
E: int # 123456789, # Event time
|
E: int # Event time
|
||||||
s: str # "BNBBTC", # Symbol
|
s: str # Symbol
|
||||||
a: int # 12345, # Aggregate trade ID
|
a: int # Aggregate trade ID
|
||||||
p: float # "0.001", # Price
|
p: float # Price
|
||||||
q: float # "100", # Quantity
|
q: float # Quantity
|
||||||
f: int # 100, # First trade ID
|
f: int # First trade ID
|
||||||
l: int # 105, # Last trade ID
|
l: int # Last trade ID
|
||||||
T: int # 123456785, # Trade time
|
T: int # Trade time
|
||||||
m: bool # true, # Is the buyer the market maker?
|
m: bool # Is the buyer the market maker?
|
||||||
M: bool # true # Ignore
|
M: bool # Ignore
|
||||||
|
|
||||||
|
|
||||||
async def stream_messages(ws):
|
async def stream_messages(ws):
|
||||||
|
|
Loading…
Reference in New Issue