Skip to content

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.dll"
#r "BeloSoft.Bfexplorer.Service.Core.dll"
open BeloSoft.Data
open BeloSoft.Bfexplorer.Domain
open BeloSoft.Bfexplorer.Service
// Comment this line when executing in Bfexplorer Console
let bfexplorer : IBfexplorerConsole = nil
let haveProfit (selection : Selection) =
isActiveSelection selection && (defaultNullableArg selection.ProfitBalance 0.0) > 0.0
let haveProfitAndUnmatchedLayBets (selection : Selection) =
if haveProfit selection
then
selection.Bets |> Seq.exists (fun bet -> bet.OrderStatus <> BetOrderStatus.Matched && bet.BetType = BetType.Lay)
else
false
let getMySelections filter (market : Market) =
market.Selections |> Seq.filter filter |> Seq.toList
let reportSelections (selections : Selection list) =
selections
|> List.map (fun selection -> sprintf "%s: %.2f" selection.Name (defaultNullableArg selection.ProfitBalance 0.0))
|> String.concat "\n"
|> printf "%s"
let getSelectionsWithProfitAndUnmatchedLayBets market = getMySelections haveProfitAndUnmatchedLayBets market
//let mySelections = bfexplorer.ActiveMarket |> getMySelections haveProfit
let mySelections = getSelectionsWithProfitAndUnmatchedLayBets bfexplorer.ActiveMarket
if mySelections.IsEmpty
then
printf "No qualified selection/s!"
else
reportSelections mySelections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.