DAYTRADINGDEPORTIVO 2 Posted December 7, 2018 I work in a Script, this is to place a bet on OVER 0.5 at a price of 1.05 with a stake of 5 in the programming window I was trying but it seems that my code has an error since the bet is not thrown I'm not sure if I select the Market over 0.5 correctly. //=========================================AJUSTE DE ORDEN====================================================================== [Category("2. Order")] [DisplayName("Precio OVER 0.5")] public decimal OrderPrice { get; set; } = 1.05M; [Category("2. Order")] [DisplayName("Precio OVER 1.5")] public decimal OrderPrice2 { get; set; } = 1.28M; [Category("2. Order")] [DisplayName("Cantidad de Stake (10% from Balance)")] public decimal PercentSize { get { return _size; } set { if (_size == value) return; if (value <= 0 || value > 100) return; _size = value; } } private decimal _size = 5; //==============================================PARAMETROS DE SELECCIÓN=============================================================== [Category("3. Conditions of Selection")] [DisplayName("Pecio de Over 1.5")] public decimal FavPriceLay { get; set; } = 1.30M; [Category("3. Conditions of Selection")] [DisplayName("Liquidez en el mercado, mas de")] public decimal TotalMatched { get; set; } = 1000; //===============================================CONDICIONES DE ENTRADA======================================================== [Category("4. Conditions of Enter")] [DisplayName("Price BACK, less")] public decimal PriceHight { get; set; } = 1.20M; [Category("4. Conditions of Enter")] [DisplayName("Price BACK, greater")] public decimal PriceLow { get; set; } = 1.05M; public override void UpdateEvents(List<Event> events) { List<RunnerCatalog> runners = Api.Soccer.SelectFavorite(events, FavPriceLay, TotalMatched); foreach(var runner in runners) { foreach (var ev in events.Where(x => x.IsChecked)) { // 4.2. In EVENT find market "OVER_UNDER_05" var market = ev.MarketCatalogues.FirstOrDefault(x => x.Description.MarketType == "OVER_UNDER_05"); // 4.3. If not - continue if (market == null) continue; // 4.4. If Status - CLOSED if (market.Status == MarketStatus.CLOSED) { // 4.5. If EVENT Is Expanded - Collapse if (ev.IsExpanded) { ev.IsExpanded = false; Api.Collapse(ev); } continue; } // 4.6. If Status - OPEN if (market.Status == MarketStatus.OPEN) { // 4.7. Conditions of Enter for Price BACk - (PriceEnterLess < Back < PriceEnterMore) if (PriceHight > market.Runners[0].Back && market.Runners[0].Back > PriceLow) { // 4.8. We Check that we did not place order in this EVENT if (!Events.ContainsKey(ev.Id)) { // 4.9. Add EVENT to Dictionary Events.Add(ev.Id, ev); // 4.10. Write to LOG and place order Api.Log($"Event:{ev.Name}; Runner:{market.Runners[0]}; Back:{market.Runners[0].Back};"); Api.PlaceLimitOrder(runner, Side.BACK,OrderPrice,PercentSize); } } } } } } 2 Quote Share this post Link to post Share on other sites
Admin 90 Posted December 8, 2018 To make it easier for the user to create scripts, I create functions, such as Api.Soccer.SelectFavorite(...) But I understand that I need to make a description of them. I'll do it a little later. I will show you how to write a script without using them. Quote Share this post Link to post Share on other sites
Admin 90 Posted December 8, 2018 You have two little mistakes. - to see the markets OVER_UNDER they need to open it (expand) - In order to send orders there must be the right market Quote Share this post Link to post Share on other sites
adrianootavares 2 Posted December 8, 2018 I'm hoping to see this script work and the only function I use at betfair I'm waiting with urgency Quote Share this post Link to post Share on other sites
DAYTRADINGDEPORTIVO 2 Posted December 8, 2018 If I had doubts about the functions created, I made the adjustments but there is an error that I do not know what to do Quote Share this post Link to post Share on other sites
Admin 90 Posted December 8, 2018 Open log file and copy here full exception Quote Share this post Link to post Share on other sites
Admin 90 Posted December 8, 2018 Perhaps we have access to a variable whose value is NULL Quote Share this post Link to post Share on other sites
Admin 90 Posted December 8, 2018 I recommend downloading version 5.26 and using project template 5.26.v2 Quote Share this post Link to post Share on other sites