Skip to content

Instantly share code, notes, and snippets.

@StefanBelo
Last active October 8, 2019 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefanBelo/f5b74a8be88856a162bcd7222517462e to your computer and use it in GitHub Desktop.
Save StefanBelo/f5b74a8be88856a162bcd7222517462e to your computer and use it in GitHub Desktop.
#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