Last active
October 8, 2019 13:32
-
-
Save StefanBelo/f5b74a8be88856a162bcd7222517462e 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.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