Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kraken: use userref field AND reqid, utilize openOrders sub for most msging #368

Merged
merged 10 commits into from
Aug 3, 2022
10 changes: 5 additions & 5 deletions piker/brokers/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from fuzzywuzzy import process as fuzzy
import numpy as np
import tractor
from pydantic.dataclasses import dataclass
import wsproto

from .._cacheables import open_cached_client
Expand Down Expand Up @@ -106,14 +105,14 @@ class Pair(Struct, frozen=True):
permissions: list[str]


@dataclass
class OHLC:
"""Description of the flattened OHLC quote format.
class OHLC(Struct):
'''
Description of the flattened OHLC quote format.

For schema details see:
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams

"""
'''
time: int

open: float
Expand Down Expand Up @@ -262,6 +261,7 @@ async def bars(
for i, bar in enumerate(bars):

bar = OHLC(*bar)
bar.typecast()

row = []
for j, (name, ftype) in enumerate(_ohlc_dtype[1:]):
Expand Down
27 changes: 0 additions & 27 deletions piker/brokers/kraken/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

'''
from contextlib import asynccontextmanager as acm
from dataclasses import field
from datetime import datetime
import itertools
from typing import (
Expand All @@ -34,7 +33,6 @@
import asks
from fuzzywuzzy import process as fuzzy
import numpy as np
from pydantic.dataclasses import dataclass
import urllib.parse
import hashlib
import hmac
Expand Down Expand Up @@ -78,31 +76,6 @@
}


@dataclass
class OHLC:
'''
Description of the flattened OHLC quote format.

For schema details see:
https://docs.kraken.com/websockets/#message-ohlc

'''
chan_id: int # internal kraken id
chan_name: str # eg. ohlc-1 (name-interval)
pair: str # fx pair
time: float # Begin time of interval, in seconds since epoch
etime: float # End time of interval, in seconds since epoch
open: float # Open price of interval
high: float # High price within interval
low: float # Low price within interval
close: float # Close price of interval
vwap: float # Volume weighted average price within interval
volume: float # Accumulated volume **within interval**
count: int # Number of trades within interval
# (sampled) generated tick data
ticks: list[Any] = field(default_factory=list)


def get_config() -> dict[str, Any]:

conf, path = config.load()
Expand Down
Loading