Last active
August 19, 2019 13:53
-
-
Save StefanBelo/db014f0e5fbecbc7672576759763fdd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I @"C:\Program Files (x86)\BeloSoft\Bfexplorer\" | |
#r "BeloSoft.Data.dll" | |
#r "BeloSoft.Bfexplorer.Domain.dll" | |
#r "BeloSoft.Bfexplorer.Service.Core.dll" | |
open System | |
open BeloSoft.Data | |
open BeloSoft.Bfexplorer.Domain | |
open BeloSoft.Bfexplorer.Service | |
let [<Literal>] MyTimeInMinutes = 10.0 | |
// Comment this line for runtime | |
//let bfexplorer : IBfexplorerConsole = nil | |
async { | |
let! resultOpenMyFavouriteBetEvent = bfexplorer.OpenMyFavouriteBetEvent("Horse Racing") | |
if resultOpenMyFavouriteBetEvent.IsSuccessResult | |
then | |
let mutable time = DateTime.Now.AddMinutes(-MyTimeInMinutes) | |
let marketInfos = | |
bfexplorer.BetEventBrowserMarketCatalogs | |
|> List.map (fun marketCatalog -> marketCatalog.MarketInfo) | |
|> List.filter (fun marketInfo -> marketInfo.StartTime > time) | |
|> List.sortBy (fun marketInfo -> marketInfo.StartTime) | |
if marketInfos.Length > 0 | |
then | |
time <- (marketInfos |> List.head).StartTime.AddMinutes(-MyTimeInMinutes) | |
let myMarketInfos = ResizeArray<MarketInfo>() | |
marketInfos | |
|> List.iter (fun marketInfo -> | |
if (marketInfo.StartTime - time).TotalMinutes >= MyTimeInMinutes | |
then | |
myMarketInfos.Add(marketInfo) | |
time <- marketInfo.StartTime | |
) | |
let! resultStartMyBotStrategy = bfexplorer.StartMyBotStrategy("Start Monitoring", TimeSpan.FromMinutes(-MyTimeInMinutes), 1.0, myMarketInfos) | |
if not resultStartMyBotStrategy.IsSuccessResult | |
then | |
printf "%s" resultStartMyBotStrategy.FailureMessage | |
else | |
printf "%s" resultOpenMyFavouriteBetEvent.FailureMessage | |
} | |
|> Async.RunSynchronously |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment