Fix Redis, begin implementing MEXC
This commit is contained in:
@@ -23,15 +23,16 @@ def initialise_elasticsearch():
|
||||
|
||||
|
||||
def store_msg(index, msg):
|
||||
global client
|
||||
if not client:
|
||||
client = initialise_elasticsearch()
|
||||
if "ts" not in msg:
|
||||
msg["ts"] = datetime.utcnow().isoformat()
|
||||
try:
|
||||
result = client.index(index=index, body=msg)
|
||||
except ConnectionError as e:
|
||||
log.error(f"Error indexing '{msg}': {e}")
|
||||
return
|
||||
if not result["result"] == "created":
|
||||
log.error(f"Indexing of '{msg}' failed: {result}")
|
||||
return
|
||||
# global client
|
||||
# if not client:
|
||||
# client = initialise_elasticsearch()
|
||||
# if "ts" not in msg:
|
||||
# msg["ts"] = datetime.utcnow().isoformat()
|
||||
# try:
|
||||
# result = client.index(index=index, body=msg)
|
||||
# except ConnectionError as e:
|
||||
# log.error(f"Error indexing '{msg}': {e}")
|
||||
# return
|
||||
# if not result["result"] == "created":
|
||||
# log.error(f"Indexing of '{msg}' failed: {result}")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from decimal import Decimal as D
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class PositionLong(BaseModel):
|
||||
units: str
|
||||
@@ -373,7 +374,9 @@ class Instrument(BaseModel):
|
||||
guaranteedStopLossOrderMode: str
|
||||
tags: list[InstrumentTag]
|
||||
financing: InstrumentFinancing
|
||||
guaranteedStopLossOrderLevelRestriction: Optional[InstrumentGuaranteedRestriction] = None
|
||||
guaranteedStopLossOrderLevelRestriction: Optional[
|
||||
InstrumentGuaranteedRestriction
|
||||
] = None
|
||||
|
||||
|
||||
class AccountInstruments(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user