dev progress
This commit is contained in:
@@ -12,6 +12,7 @@ from cvttpy_tools.app import App
|
||||
from cvttpy_tools.config import Config
|
||||
from cvttpy_tools.settings.cvtt_types import IntervalSecT
|
||||
from cvttpy_tools.timeutils import SecPerHour
|
||||
from cvttpy_tools.logger import Log
|
||||
|
||||
# ---
|
||||
from cvttpy_trading.trading.instrument import ExchangeInstrument
|
||||
@@ -117,27 +118,36 @@ class PtLiveStrategy(NamedObject):
|
||||
self, hist_aggr: List[MdTradesAggregate]
|
||||
) -> None:
|
||||
# Log.info(f"on_mkt_data_hist_snapshot: {aggr}")
|
||||
# await self.pt_mkt_data_.on_mkt_data_hist_snapshot(snapshot=aggr)
|
||||
pass # URGENT PtiveStrategy.on_mkt_data_hist_snapshot()
|
||||
if not self._is_md_actual(hist_aggr=hist_aggr):
|
||||
return
|
||||
|
||||
# if market_data_df is not None:
|
||||
# self.trading_pair_.market_data_ = market_data_df
|
||||
# self.model_data_policy_.advance()
|
||||
# prediction = self.trading_pair_.run(
|
||||
# market_data_df, self.model_data_policy_.advance()
|
||||
# )
|
||||
# self.predictions_ = pd.concat(
|
||||
# [self.predictions_, prediction.to_df()], ignore_index=True
|
||||
# )
|
||||
market_data_df: Optional[pd.DataFrame] = self._create_md_pdf(hist_aggr=hist_aggr)
|
||||
if market_data_df is None:
|
||||
Log.warning(f"{self.fname()} Unable to create market data df")
|
||||
return
|
||||
|
||||
# trading_instructions: List[TradingInstruction] = (
|
||||
# self._create_trading_instructions(
|
||||
# prediction=prediction, last_row=market_data_df.iloc[-1]
|
||||
# )
|
||||
# )
|
||||
# if len(trading_instructions) > 0:
|
||||
# await self._send_trading_instructions(trading_instructions)
|
||||
# # trades = self._create_trades(prediction=prediction, last_row=market_data_df.iloc[-1])
|
||||
self.trading_pair_.market_data_ = market_data_df
|
||||
self.model_data_policy_.advance()
|
||||
prediction = self.trading_pair_.run(
|
||||
market_data_df, self.model_data_policy_.advance()
|
||||
)
|
||||
self.predictions_df_ = pd.concat(
|
||||
[self.predictions_df_, prediction.to_df()], ignore_index=True
|
||||
)
|
||||
|
||||
trading_instructions: List[TradingInstruction] = (
|
||||
self._create_trading_instructions(
|
||||
prediction=prediction, last_row=market_data_df.iloc[-1]
|
||||
)
|
||||
)
|
||||
if len(trading_instructions) > 0:
|
||||
await self._send_trading_instructions(trading_instructions)
|
||||
|
||||
def _is_md_actual(self, hist_aggr: List[MdTradesAggregate]) -> bool:
|
||||
return False # URGENT _is_md_actual
|
||||
|
||||
def _create_md_pdf(self, hist_aggr: List[MdTradesAggregate]) -> Optional[pd.DataFrame]:
|
||||
return None # URGENT _create_md_pdf
|
||||
|
||||
def interval_sec(self) -> IntervalSecT:
|
||||
return self.interval_sec_
|
||||
|
||||
Reference in New Issue
Block a user