progress
This commit is contained in:
@@ -151,6 +151,7 @@ class MdSummaryCollector(NamedObject):
|
||||
return MdSummary.from_REST_response(response=response)
|
||||
|
||||
def get_last(self) -> Optional[MdSummary]:
|
||||
Log.info(f"{self.fname()}: for {self.exch_inst_.details_short()}")
|
||||
rqst_data = self.rqst_data()
|
||||
rqst_data["history_depth_sec"] = self.interval_sec_ * 2
|
||||
response: requests.Response = self.sender_.send_post(
|
||||
@@ -186,10 +187,12 @@ class MdSummaryCollector(NamedObject):
|
||||
def set_timer(self):
|
||||
if self.timer_:
|
||||
self.timer_.cancel()
|
||||
start_in = self.next_load_time() - current_seconds()
|
||||
self.timer_ = Timer(
|
||||
start_in_sec=(self.next_load_time() - current_seconds()),
|
||||
start_in_sec=start_in,
|
||||
func=self._load_new,
|
||||
)
|
||||
Log.info(f"{self.fname()} Timer for {self.exch_inst_.details_short()} is set to run in {start_in} sec")
|
||||
|
||||
def next_load_time(self) -> NanosT:
|
||||
curr_sec = int(current_seconds())
|
||||
|
||||
+4
-10
@@ -10,13 +10,13 @@ from cvttpy_tools.logger import Log
|
||||
from cvttpy_trading.trading.trading_instructions import TradingInstructions
|
||||
# ---
|
||||
from pairs_trading.lib.live.rest_client import RESTSender
|
||||
from pairs_trading.apps.pairs_trader import PairsTrader
|
||||
from pairs_trading.apps.pair_trader import PairTrader
|
||||
|
||||
|
||||
class TradingInstructionsSender(NamedObject):
|
||||
config_: Config
|
||||
sender_: RESTSender
|
||||
pairs_trader_: PairsTrader
|
||||
pairs_trader_: PairTrader
|
||||
|
||||
class TradingInstType(str, Enum):
|
||||
TARGET_POSITION = "TARGET_POSITION"
|
||||
@@ -24,13 +24,7 @@ class TradingInstructionsSender(NamedObject):
|
||||
MARKET_MAKING = "MARKET_MAKING"
|
||||
NONE = "NONE"
|
||||
|
||||
# config_: Config
|
||||
# ti_method_: str
|
||||
# ti_url_: str
|
||||
# health_check_method_: str
|
||||
# health_check_url_: str
|
||||
|
||||
def __init__(self, config: Config, pairs_trader: PairsTrader) -> None:
|
||||
def __init__(self, config: Config, pairs_trader: PairTrader) -> None:
|
||||
self.config_ = config
|
||||
base_url = self.config_.get_value("cvtt_base_url", default="")
|
||||
assert base_url
|
||||
@@ -45,7 +39,7 @@ class TradingInstructionsSender(NamedObject):
|
||||
|
||||
|
||||
async def send_trading_instructions(self, ti: TradingInstructions) -> None:
|
||||
|
||||
Log.info(f"{self.fname()}: sending {ti=}")
|
||||
response: requests.Response = self.sender_.send_post(
|
||||
endpoint="trading_instructions", post_body=ti.to_dict()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user