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);
}
}
}
}
}
}