Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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 bfexplorer = nil<IBfexplorerConsole>
let reportMarketSelectionData (market : Market, selection : Selection) =
printfn "%s - %s: %.2f" market.MarketFullName selection.Name selection.LastPriceTraded
let isMyFootballMatchOddsMarket (market : Market) =
let homeTeamSelection = market.Selections.[0]
reportMarketSelectionData (market, homeTeamSelection)
homeTeamSelection.LastPriceTraded <= 1.8
let isMyFootballOverUnderMarket (market : Market) =
let overSelection = market.Selections.[1]
reportMarketSelectionData (market, overSelection)
overSelection.LastPriceTraded >= 1.5
async {
let! result = bfexplorer.OpenMyFavouriteBetEvent("Football - Top Leagues")
if result.IsSuccessResult
then
let today = DateTime.Today
let marketInfos =
bfexplorer.BetEventBrowserMarketCatalogs
|> List.filter (fun marketCatalog -> marketCatalog.MarketInfo.StartTime.Date = today)
|> List.map (fun marketCatalog -> marketCatalog.MarketInfo)
let! resultMyMarkets = bfexplorer.GetMyMarkets(marketInfos)
match resultMyMarkets with
| DataResult.Success markets ->
for market in markets do
if isMyFootballMatchOddsMarket market
then
let! resultAssociatedMarkets = bfexplorer.GetMyAssociatedMarkets(market.MarketInfo, [| "OVER_UNDER_25" |])
if resultAssociatedMarkets.IsSuccessResult
then
let marketOverUnder = resultAssociatedMarkets.SuccessResult.Head
if isMyFootballOverUnderMarket marketOverUnder
then
bfexplorer.OpenMyMarkets([ market; marketOverUnder ])
| DataResult.Failure errorMessage -> printfn "%s" errorMessage
else
printfn "%s" result.FailureMessage
}
|> Async.RunSynchronously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment