Created
October 21, 2018 11:23
-
-
Save StefanBelo/b990db1d8af6a4f5000cc86891cd771e 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 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