-
Notifications
You must be signed in to change notification settings - Fork 24
Description
-
the easiest way would be to develop a strategy and tunnel all these methods to python interpreter instantiated within this wrapper strategy:
-
a more flexible way is to develop two proxies / communicators that allow bidirectional Remote Procedure Call from C# to Python and back from Python to C#; I have not studied which library may facilitate this but this way the user has full and direct control over launching python scripts in their own console with logging / messages / dialogues; SquareOne should wait until python script is launched and then they talk;
https://github.com/worldexplorer/SquareOne/wiki/Userland-Scripts-development
Methods that need to be "tunneled" to Python to setup something prior to each backtest begins:
- public virtual void InitializeBacktest();
Methods that need to be "tunneled" to Python to generate Alerts:
- public virtual void InitializeBacktest();
- public virtual void OnNewQuoteOfStreamingBarCallback(Quote quoteNewArrived);
- public virtual void OnBarStaticLastFormedWhileStreamingBarWithOneQuoteAlreadyAppendedCallback(Bar barNewStaticArrived);
Methods that need to be "tunneled" to Python to notify the changes of Alerts' state:
- public virtual void OnAlertFilledCallback(Alert alertFilled);
- public virtual void OnAlertKilledCallback(Alert alertKilled);
- public virtual void OnAlertNotSubmittedCallback(Alert alertNotSubmitted, int barNotSubmittedRelno);
Methods that need to be "tunneled" to Python to notify the changes of Orders' state:
- public virtual void OnPositionOpenedCallback(Position positionOpened);
- public virtual void OnPositionOpenedPrototypeSlTpPlacedCallback(Position positionOpenedByPrototype);
- public virtual void OnPositionClosedCallback(Position positionClosed);
Methods that Python should be able to invoke in order to create buy/sell signals:
- public Position BuyAtLimit(Bar bar, double limitPrice, string signalName = "BOUGHT_AT_LIMIT");
- public Position BuyAtMarket(Bar bar, string signalName = "BOUGHT_AT_MARKET");
- public Position BuyAtStop(Bar bar, double stopPrice, string signalName = "BOUGHT_AT_STOP");
- public Alert CoverAtLimit(Bar bar, Position position, double limitPrice, string signalName = "COVERED_AT_LIMIT");
- public Alert CoverAtMarket(Bar bar, Position position, string signalName = "COVERED_AT_MARKET");
- public Alert CoverAtStop(Bar bar, Position position, double stopPrice, string signalName = "COVERED_AT_STOP");
- public Alert SellAtLimit(Bar bar, Position position, double limitPrice, string signalName = "SOLD_AT_LIMIT");
- public Alert SellAtMarket(Bar bar, Position position, string signalName = "SOLD_AT_MARKET");
- public Alert SellAtStop(Bar bar, Position position, double stopPrice, string signalName = "SOLD_AT_STOP");
- public Position ShortAtLimit(Bar bar, double limitPrice, string signalName = "SHORTED_AT_LIMIT") ;
- public Position ShortAtMarket(Bar bar, string signalName = "SHORTED_AT_MARKET");
- public Position ShortAtStop(Bar bar, double stopPrice, string signalName = "SHORTED_AT_STOP");
- public Alert ExitAtMarket(Bar bar, Position position, string signalName = "EXITED_AT_MARKET")
- public Alert ExitAtLimit(Bar bar, Position position, double price, string signalName = "EXITED_AT_LIMIT")
Methods that Python should be able to invoke in order to close positions:
- public void AlertKillPending(Alert alert);
- public List PositionCloseImmediately(Position position, string signalName);
- public List PositionKillExitAlert(Position position, string signalName);
- public List PositionPrototypeKillWhateverIsPending(PositionPrototype proto, string signalName)
Methods that Python should be able to invoke in order to mark the chart with colors/labels:
- public void SetBarColorBackground(Bar bar, Color color);
- public void SetBarColorBackground(Bar bar, Color color, ChartPanelType chartPanelType);