binance: add futes API link, freeze the agg tradez struct
parent
75ff3921b6
commit
937d8c410d
|
@ -55,7 +55,7 @@ from ._util import (
|
||||||
DataUnavailable,
|
DataUnavailable,
|
||||||
)
|
)
|
||||||
from ._util import (
|
from ._util import (
|
||||||
log,
|
get_logger,
|
||||||
get_console_log,
|
get_console_log,
|
||||||
)
|
)
|
||||||
from piker.data.types import Struct
|
from piker.data.types import Struct
|
||||||
|
@ -67,6 +67,9 @@ from piker.data._web_bs import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
log = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
_url = 'https://api.binance.com'
|
_url = 'https://api.binance.com'
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,7 +354,7 @@ async def get_client() -> Client:
|
||||||
|
|
||||||
|
|
||||||
# validation type
|
# validation type
|
||||||
class AggTrade(Struct):
|
class AggTrade(Struct, frozen=True):
|
||||||
e: str # Event type
|
e: str # Event type
|
||||||
E: int # Event time
|
E: int # Event time
|
||||||
s: str # Symbol
|
s: str # Symbol
|
||||||
|
@ -455,10 +458,16 @@ async def stream_messages(
|
||||||
|
|
||||||
|
|
||||||
def make_sub(pairs: list[str], sub_name: str, uid: int) -> dict[str, str]:
|
def make_sub(pairs: list[str], sub_name: str, uid: int) -> dict[str, str]:
|
||||||
"""Create a request subscription packet dict.
|
'''
|
||||||
|
Create a request subscription packet dict.
|
||||||
|
|
||||||
https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams
|
- spot:
|
||||||
"""
|
https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams
|
||||||
|
|
||||||
|
- futes:
|
||||||
|
https://binance-docs.github.io/apidocs/futures/en/#websocket-market-streams
|
||||||
|
|
||||||
|
'''
|
||||||
return {
|
return {
|
||||||
'method': 'SUBSCRIBE',
|
'method': 'SUBSCRIBE',
|
||||||
'params': [
|
'params': [
|
||||||
|
|
Loading…
Reference in New Issue