Author Topic: Using created variables  (Read 1592 times)

Tags:
  • All members
  • Posts: 33
  • Gender: Male
Using created variables
« on: 06 Oct 2020, 10:49 »
I'm trying to code some calculations, but have got stuck on a few points:

Say I create a user variable, 'myvar', per selection in a particular market. How do I then call this for use in a) the same market from different selections; b) from a different market for the same selection; c) from a different market for a different selection.

My main issue is that existing variables work as expected, but not the created ones. So a) r_(sel_order+1)_back_price works, but r_(sel_order+1)_myvar doesn't; b) winplace_back_price works, but winplace_myvar doesn't; c) winplace_r_(sel_order+1)_back_price (probably) works, but not winplace_r_(sel_order+1)_back_price.

Am I missing something in the syntax (e.g. should I be using 's' instead of 'r') or setup (e.g. do I need to 'remember' the user variables as well as create them)?

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: Using created variables
« Reply #1 on: 14 Oct 2020, 12:22 »
Hello!

You cannot address a user variable with prefixes or inside other selection/market variables. Doing so will result in the program replacing the name of the variable with a value, so you will end up with r_(sel_order+1)_5.5 instead of r_(sel_order+1)_myvar for example. User variables are always parsed before any other variables.

It's hard to address your issue without further details about what you're trying to achieve. Maybe provide an example of a concrete situation?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 33
  • Gender: Male
Re: Using created variables
« Reply #2 on: 14 Oct 2020, 18:30 »
Hi Oxa

I'm looking to make a variable calculated in one particular market of an event available as an individual variable for each selection across the event (I've also made a post on the suggestions board for a 'per selection per event' user variable type).

For example, I've set something up to calculate (in a reasonably complex manner) a user variable ('toptwo') which provides the probability that each horse will finish in the top two places based on the prices available in the win market. However, the variable seems to be only available in the market it was calculated in due to the conditions necessarily imposed to make the calculations (i.e. 'win markets' or places=1).

At the moment I'm limited to working in one place market, as I can compare the 'toptwo' value with winplace_ prices, but even then I've had to setup a couple of triggers to make the information actionable in the place market (i.e. to actually bet in the 2TBP market based on the comparison takes me 3 triggers - 1 to compare in the win market and identify the SEL, 1 to bet on SEL, and 1 to reset the other two triggers so that it can bet on more than one horse if conditions are right; and this also makes it harder to dutch SELs).

Although it would also be useful to be able to compare the values between selections (e.g. combined values for ranks 1&2 vs ranks 3&4), I would primarily like the calculated 'toptwo' probability value for each selection to be available in every market of that event (so that it can be compared with the odds available in different markets for the same selection). Is there some easy way of doing that?



  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: Using created variables
« Reply #3 on: 16 Oct 2020, 22:14 »
Have you tried using the "Individually for each sports event" variable scope? It will allow you to create variables in place markets that are visible in win markets and vice versa.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 33
  • Gender: Male
Re: Using created variables
« Reply #4 on: 17 Oct 2020, 15:12 »
Yes, but the 'Individually for each event' user variable setting applies a single value across all selections in the event, whereas I need different values specific to each selection to become available to each selection across the event. It seems I can have values 'per selection' OR 'for each event', but not 'per selection for each event'. Hopefully the following clarifies a bit more:


Stage 1:

A set of triggers manages the calculations for the probability of a top two finish (which is the sum of its 1st place probability + the sum of the probabilities of all the ways it can finish second, as defined by odds available in the win market (i.e. 1/back_price)). This is set to calculate iteratively so that it can manage any number of runners, but without requiring a trigger set for every possible number of runners. This setup provides a "toptwo" user variable, with the value set "individually per selection", such that each and every selections "toptwo" has a different value (i.e. the probability that the specific selection itself will be in the top two).


Stage 2:

I want that final 'toptwo' output value (i.e. the resolved value only), for each and every selection, to be visible in all other markets of the event for at least the selection itself (i.e. 'toptwo' has the specific value for  each selection regardless of which market in the event it is used in), and potentially/ideally so that it can be available for other selections use (i.e. via 'r_1_toptwo' or similar). However, I just can't seem to get the selections own 'toptwo' value to apply to that selection across the event:

Using "Individually for each event" will transfer a value, but it takes only one (the last) selections 'toptwo' value and applies it to all selections.

Adding an extra 'toptwo' = 'toptwo' trigger with no conditions and "Individually per selection" will not transfer anything beyond the market it was created in, as the 'toptwo' expression was not calculated in other markets.

Adding identifiers to the variable might have made "Individually for each event" workable (e.g. 'toptwo_sel_index' or 'sel_index_toptwo'), but parsing order doesn't seem to permit this.

I've even tried doing it 'for each event' for one selection at a time, but this also applies the value to the event rather than the selection.



It seems like this should be something relatively simple to do, but I just can't seem to figure out how...

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: Using created variables
« Reply #5 on: 20 Oct 2020, 07:50 »
Quote
I want that final 'toptwo' output value (i.e. the resolved value only), for each and every selection, to be visible in all other markets of the event

What do you want it to be visible for? E.g. for backing on some selection with toptwo > X and < Y?
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 33
  • Gender: Male
Re: Using created variables
« Reply #6 on: 20 Oct 2020, 11:37 »
Broadly, yes. In this case I want to compare the variable produced from the win market (e.g. SEL is calculated as having 25% chance of finishing top two) with the price available in the relevant place market (not necessarily winplace_), and then bet in said relevant place market if I consider the conditions favourable in some (further calculated) way (e.g. SEL prices in 2TBP give that SEL X% more or less chance than the 'toptwo' value then I'd bet on it).


In an entirely separate case, I have a different setup that looks to ARB across 3 markets. For this one, I'd just want to push created variables for the price and amount for each selection into each market. Running the calcs in all three markets adds load, and values aren't always in sync - whereas running calcs in one market only ensures no syncing issues, but I can't then get the relevant values into the other two markets easily.


I'm not sure if these cases are different from a coding point of view, but in both I just want to make a calculation for each selection, and then set that resolved output value as a variable applicable to that respective selection in all event markets (i.e. as if I had originally made the variable with the resolved output value, rather than by calculating it).

  • Administrator
  • Posts: 8826
  • Gender: Female
*
Re: Using created variables
« Reply #7 on: 21 Oct 2020, 21:50 »
This arrangement would require some substantial changes to the program's code I'm afraid.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

 

Please note, BetFair is seems to be currently OFFLINE