Make current price work with date offsets
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Controllers.ProjectTest {
|
||||
foreach(PurchasedStock cur in StockHistory) {
|
||||
if (cur.Sold == false) {
|
||||
// Get sell price
|
||||
float sellPrice = cur.Quantity * _aiModule.GetCurrentPrice( cur.Symbol );
|
||||
float sellPrice = cur.Quantity * _aiModule.GetCurrentPrice( cur.Symbol, i );
|
||||
// Add up the total sale
|
||||
totalSale += sellPrice;
|
||||
// Mark as sold
|
||||
@@ -85,7 +85,7 @@ namespace Controllers.ProjectTest {
|
||||
if (i != 0) {
|
||||
|
||||
// Buy predicted stock
|
||||
float stockPrice = _aiModule.GetCurrentPrice( HighestRanking.Symbol );
|
||||
float stockPrice = _aiModule.GetCurrentPrice( HighestRanking.Symbol, i );
|
||||
|
||||
// Get max stocks user can purchase [ int cast truncates the decimal ]
|
||||
int MaxQty = (int)( Money / stockPrice );
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace Controllers.PythonInterop {
|
||||
}
|
||||
}
|
||||
|
||||
public float GetCurrentPrice(string StockSymbol) {
|
||||
(bool, string) Success = PyProcess.RunPythonProcess(_PyPath, _ExecPath + "/currentprice.py", returns: true, PyArgs: StockSymbol);
|
||||
public float GetCurrentPrice(string StockSymbol, int DataEndDaysAgo = 0) {
|
||||
(bool, string) Success = PyProcess.RunPythonProcess(_PyPath, _ExecPath + "/currentprice.py", returns: true, PyArgs: $"{StockSymbol} {DataEndDaysAgo}");
|
||||
if (!Success.Item1) {
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user