|
Post by hutchie91 on Jul 2, 2021 6:11:49 GMT
Hi all,
I'm trying to find a way to get the @price_1 from all horses in a race (one at a time is fine), and I'm not sure any of the existing functions do exactly what I'm after.
What I want to be able to do is essentially dbo.fn_GetPrice(@id_race, @position_n, @price_n, 1), but those options aren't available in the documentation. The issue at the moment is the @price_n bit, with dbo.fn_GetPrice only seeming to allow for back or lay price right now.
Is this something I'd need to build a custom function for?
|
|
|
Post by Ipposnif on Jul 6, 2021 11:27:20 GMT
Hi, when you say "get the @price_1 from all horses in a race" you mean you want a collection (array) of all best BACK prices? if the answer is yes, what do you want to do with this collection?
|
|
|
Post by hutchie91 on Jul 7, 2021 1:34:27 GMT
Hi there,
It's not so much all best back prices, I just want to be able to access the matched price at 60 seconds to the jump for all horses. I can access it for @id_horse just by using the @price_1 variable, but I was hoping to find or build a function to access this data point (which is stored in the SQL server) for all horses. In short, I want this as part of a dutching strategy which is showing promise, but I'm finding that using the current best back/lay pricing is causing a few issues.
Essentially, if I'm dutching 6 horses, I'm finding the odds are shifting quickly enough that the calculations for the 1st and the 6th horse are slightly different, as the odds have shifted. This causes enough fluctuations in my results to be annoying, if nothing else. I'm hoping to avoid this by using a fixed value for all calculations, and the @price_1 variable is the best option for this strategy. However, I need to be able to access @price_1 for all horses (1-6 in this example), not just @id_horse in order to work out the dutch bet amounts with the most accuracy.
I can also see dbo.fn_RaceHorseProperty(@id_race, @position_n, 'price_1', 1) or something similar working, if that helps explain what I want to achieve.
|
|
|
Post by Ipposnif on Jul 8, 2021 11:05:41 GMT
Hi, Ipposnif checks the conditions one horse at one time. When the program checks the conditions it knows the ID of the horse (and of the race) checked at that moment. So if you call dbo.fn_RaceHorseProperty(@id_race, @id_horse, 'back_prices' , 1) you get the best BACK price, and it is the same as using the variable @best_back_price. @price_1 is the price recorded at 60 seconds to the start. But in order to calculate the dutching size for the bet on the current horse, you need to get the best BACK prices of other horses (of the same race). Is it correct? You could use fn_RaceHorseProperty, but the problem is that you don't know the IDs of the other horses. So the only solution that comes to my mind now is to create a new dutching function, that takes as parameters the id of the current horse (we know it), the id of the current race (we know it) and calculates the size of the bet using the prices of the other horses. In the function we can get the IDs of the other horses (and the prices), because the other horses are always filtered using a fixed logic, for example: the top 6 favorites with an odd lower than 8.00 Instead if you already found a way to refer to the other horses, and what you need is simply to get the @price_1 of them, tell me and I will modify the fn_RaceHorseProperty for you.
|
|
|
Post by hutchie91 on Jul 8, 2021 14:32:38 GMT
Hi,
I think the offer to modify fn_RaceHorseProperty is exactly what I'm looking for. I've managed to build the formulas I'm looking to use, but using best back price causes fluctuations as the price moves slightly in the time I calculate for one horse to the next.
If you're able to modify fn_RaceHorseProperty, or tell me how to modify it in SQL server, that would be absolutely amazing.
My current bet size formula is
(100/(dbo.fn_RaceHorseProperty(@id_race, @id_horse, 'back_prices', 1)))/
((100/(dbo.fn_RaceHorseProperty(@id_race, @id_favourite_1, 'back_prices', 1)))+(100/(dbo.fn_RaceHorseProperty(@id_race, @id_favourite_2, 'back_prices', 1)))+(100/(dbo.fn_RaceHorseProperty(@id_race, @id_favourite_3, 'back_prices', 1)))+(100/(dbo.fn_RaceHorseProperty(@id_race, dbo.fn_RaceProperty (@id_race, 'favourite_by_odd', 4), 'back_prices', 1)))+(100/(dbo.fn_RaceHorseProperty(@id_race, dbo.fn_RaceProperty (@id_race, 'favourite_by_odd', 5), 'back_prices', 1)))+(100/(dbo.fn_RaceHorseProperty(@id_race, dbo.fn_RaceProperty (@id_race, 'favourite_by_odd', 6), 'back_prices', 1))))
*
(@capital/@global_01) And I just want to replace all 'back_prices' with '@price_1'
|
|
|
Post by Ipposnif on Jul 9, 2021 12:08:47 GMT
I forgot about it, but there is already what you are looking for. Help is not yet updated.
The syntax is: dbo.fn_RaceHorseProperty(@id_race, @id_horse, 'rec_back_price', 1)
where 1 means "get the price recorded at 1 minute at the start"
so if you want the price at 5 minutes the syntax is: dbo.fn_RaceHorseProperty(@id_race, @id_horse, 'rec_back_price', 5)
prices are recorded only at these minutes at the start: 1,2,3,4,5,10,15,30,60,180
Notes: 1) A price can be retrieved only after it has been recorded: so you cannot get price_1 at two minutes at the start. 2) Your approach to the problem is correct, cheers! The only limit (if it is a limit for you) is that you can refer only the first 3 favorites of the races. I will extend this in the next release.
|
|
|
Post by hutchie91 on Jul 9, 2021 12:27:27 GMT
This is absolutely amazing, thank you so very much
|
|