dev progress
This commit is contained in:
+33
-14
@@ -15,7 +15,7 @@ from cvttpy_trading.trading.active_instruments import Instruments
|
||||
from cvttpy_trading.trading.mkt_data.md_summary import MdTradesAggregate
|
||||
# ---
|
||||
from pairs_trading.lib.pt_strategy.live.live_strategy import PtLiveStrategy
|
||||
# from pairs_trading.lib.pt_strategy.live.pricer_md_client import PtMktDataClient
|
||||
from pairs_trading.lib.live.mkt_data_client import CvttRestMktDataClient, MdSummary
|
||||
from pairs_trading.lib.pt_strategy.live.ti_sender import TradingInstructionsSender
|
||||
|
||||
# import sys
|
||||
@@ -23,6 +23,20 @@ from pairs_trading.lib.pt_strategy.live.ti_sender import TradingInstructionsSend
|
||||
# for path in sys.path:
|
||||
# print(path)
|
||||
|
||||
'''
|
||||
Config
|
||||
=======
|
||||
{
|
||||
"cvtt_base_url": "http://cvtt-tester-01.cvtt.vpn:23456",
|
||||
"ti_config": {
|
||||
TODO
|
||||
},
|
||||
"strategy_config": {
|
||||
TODO
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
HistMdCbT = Callable[[List[MdTradesAggregate]], Coroutine]
|
||||
UpdateMdCbT = Callable[[MdTradesAggregate], Coroutine]
|
||||
|
||||
@@ -31,7 +45,7 @@ class PairsTrader(NamedObject):
|
||||
instruments_: List[JsonDictT]
|
||||
|
||||
live_strategy_: PtLiveStrategy
|
||||
# pricer_client_: PtMktDataClient
|
||||
pricer_client_: CvttRestMktDataClient
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.instruments_ = []
|
||||
@@ -90,16 +104,10 @@ class PairsTrader(NamedObject):
|
||||
Log.info(f"{self.fname()} Strategy created: {self.live_strategy_}")
|
||||
|
||||
# # ------- CREATE PRICER CLIENT -------
|
||||
# URGENT
|
||||
# pricer_config = self.config_.get_subconfig("pricer_config", {})
|
||||
# self.pricer_client_ = PtMktDataClient(
|
||||
# live_strategy=self.live_strategy_,
|
||||
# pricer_config=pricer_config
|
||||
# )
|
||||
# Log.info(f"{self.fname()} CVTT Pricer client created: {self.pricer_client_}")
|
||||
self.pricer_client_ = CvttRestMktDataClient(self.config_)
|
||||
|
||||
# ------- CREATE TRADER CLIENT -------
|
||||
# URGENT
|
||||
# URGENT CREATE TRADER CLIENT
|
||||
# (send TradingInstructions)
|
||||
# ti_config = self.config_.get_subconfig("ti_config", {})
|
||||
# self.ti_sender_ = TradingInstructionsSender(config=ti_config)
|
||||
@@ -107,12 +115,23 @@ class PairsTrader(NamedObject):
|
||||
|
||||
|
||||
# # ------- CREATE REST SERVER -------
|
||||
# for dashboard communications
|
||||
# URGENT CREATE REST SERVER for dashboard communications
|
||||
|
||||
async def subscribe_md(self) -> None:
|
||||
pass
|
||||
# URGENT implement PairsTrader.subscribe_md()
|
||||
|
||||
for inst in self.instruments_:
|
||||
exch_acct = inst.get("exch_acct", "?exch_acct?")
|
||||
instrument_id = inst.get("instrument_id", "?instrument_id?")
|
||||
await self.pricer_client_.add_subscription(
|
||||
exch_acct=exch_acct,
|
||||
instrument_id=instrument_id,
|
||||
interval_sec=self.live_strategy_.interval_sec(),
|
||||
history_depth_sec=self.live_strategy_.history_depth_sec(),
|
||||
callback=self._on_md_summary
|
||||
)
|
||||
|
||||
def _on_md_summary(self, history: List[MdSummary]) -> None:
|
||||
pass # URGENT
|
||||
|
||||
async def run(self) -> None:
|
||||
Log.info(f"{self.fname()} ...")
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user