Finalize the preditctor algorithm
This commit is contained in:
@@ -22,6 +22,13 @@ namespace Controllers.Automation {
|
||||
// Start this process on a background thread so its non-blocking
|
||||
Task thread = new Task(() => {
|
||||
|
||||
// Check if the day is a weekend
|
||||
DateTime chosenDate = DateTime.Now.AddDays(-DaysBefore);
|
||||
if (chosenDate.DayOfWeek == DayOfWeek.Saturday || chosenDate.DayOfWeek == DayOfWeek.Sunday) {
|
||||
// If its a weekend skip
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the userlist
|
||||
List<string> VerifiedUserList = new List<string>(){ "TESTMODE" };
|
||||
if (!testmode) {
|
||||
@@ -121,6 +128,9 @@ namespace Controllers.Automation {
|
||||
|
||||
// Get sell price
|
||||
float sellPrice = cur.Quantity * _aiModule.GetCurrentPrice( cur.Symbol );
|
||||
if (sellPrice == 0) {
|
||||
return -1f;
|
||||
}
|
||||
|
||||
// Try create payment session
|
||||
(bool, string) createResult = _paymentProcessor.CreatePayment(username);
|
||||
@@ -157,6 +167,9 @@ namespace Controllers.Automation {
|
||||
|
||||
// Get Stock Price
|
||||
float stockPrice = _aiModule.GetCurrentPrice( stockSymbol );
|
||||
if (stockPrice == 0) {
|
||||
return -1f;
|
||||
}
|
||||
|
||||
// Get max stocks user can purchase [ int cast truncates the decimal ]
|
||||
int MaxQty = (int)( Money / stockPrice );
|
||||
|
||||
Reference in New Issue
Block a user