harveysburger / pinnaclewrapper

A C# Wrapper for the PinnacleSports API
25 stars 56 forks source link

Result after placing a Bet #13

Open Eliakos opened 4 years ago

Eliakos commented 4 years ago

Hello,

I don't know yet how the pinnacle/ps3838 process work and how it's handled by the wrapper.

When we place a bet, it’s accepted or rejected but if accepted, is it accepted as is? ie with the submitted stake at the given odd OR can we have as a result a partial stake accepted at the given odd OR several splitted accepted stakes at differents odds?

harveysburger commented 4 years ago

No partial stake, the whole bet will have the requested odds OR be accepted at better odds.

The bet response should have the final odds that the bet was accepted at.

When placing the bet request there is a setting named something like "acceptBetterOdds", if that's true then your bet might be accepted at better odds in case the line moves. If it s false your bet is only accepted if the line didn't move

harveysburger commented 4 years ago

Either way it s an all or nothing thing, no partial bets

Eliakos commented 4 years ago

Ok, no partial bets no splitted bets, thank you, good to know so it's a simplier managment than in betting exchange.

Would you have a code example of placing a bet with the "acceptBetterOdds" parameter set to true?

Thanks about the other issue related to calls delay. Just to confirm (because the issue is closed, in the context if automated betting, i suppose we should introduce a delay between the calls, what do you think of? Anyway do you confirm there is actually no delay managment in the wrapper?

harveysburger commented 4 years ago

Correct no built in delay mechanism in the Wrapper so you have to manage the delays yourself.

Also the delays are never for placing bets, they ll be happy if you place bets non stop :)

It s really about the other Api calls. Especially if you make calls frequently without providing the "since" parameter, that will get you closed quickly.

harveysburger commented 4 years ago

As for the acceptBetterOdds, I don't have code sample handy, on my phone now, but all you need to do is toggle to true the boolean in your bet request, see here:

https://github.com/harveysburger/pinnaclewrapper/blob/master/PinnacleWrapper/Data/PlaceBetRequest.cs

harveysburger commented 4 years ago

This one here

    [JsonProperty(PropertyName = "acceptBetterLine")]
    public bool AcceptBetterLine;
Eliakos commented 4 years ago

Lol yes placing bets non stop ahaha they would surf on pleasure and would fire the one who would introduce a limitation on that :)

Well about the since, : with the since parameter must be restricted to once every 5 seconds while without it's 60 seconds so i think they would be more unhappy if you call frequently the second one which consue more resources on their end :)

Anyway, in an automated trading context, i should ad some delays betwee those kind of lines :

                var ClientBalance = await api.GetClientBalance();
                var fixtures = await api.GetFixtures(new GetFixturesRequest(SampleSportId, lastFixture));
                var lines = await api.GetOdds(new GetOddsRequest(fixtures.SportId,
                    fixtures.Leagues.Select(i => i.Id).ToList(), lastLine, false));

Yes i saw in the netcore wrapper release (allowing to access the source), it was acceptBetterLine instead of acceptBetterOdds, it's just that as i begin in c#, i'm not sure how to make the PlaceBetRequest call yet, reason why a code line example would be useful for starters like me.

I mean, i suppose this would looks something like : var placebet = await api.PlaceBet(new PlaceBetRequest(acceptBetterLine : 1)); I mentionned something "like" :)

As for the PlaceBetResponse, i don't see the syntax, ie how to catch the result with

harveysburger commented 4 years ago

I'll dig up something, but in short you have the right idea, instantiate a new betrequest object and fill in the details of every properties, or most of them anyway, then pass it to api.PlaceBet

Your var placebet should have the response. One thing to know however is with live markets you'll only get a confirmation that your request is in process or something. You have to query the status of your bet few seconds later to get the outcome. Depending on the sport the delay isn't always the same but expect 5 to 10 seconds delay before your bet is officially rejected or accepted. For pre-game however it's instantaneous.(to get status of your bet there is another Api, forgot the name but might be something like getBet)

I am still on my phone so can't really confirm the details tonight

Eliakos commented 4 years ago

That would be very cool, this is clearly the kind of things that help to understand and teach how to use a given resource (here pinaclewrapper) because you discover the articulation and the logic behind the points you're blocking on at a given moment in time.

Thanks for the info about the delayed info on live events, i would not have expected that (one more things matchbbok does not work that way, the other one was about the live event parameter which is much more logic on matchbook in my eyes). Would you have an example of that as well ? (just the one or 2 lines showing it, not a whole software :) )

Yep, phones are useful to discuss but contrary to what we see in the movie, are short to really dive into the matrix :)

Eliakos commented 4 years ago

Hi,

Any update?

Eliakos commented 4 years ago

Hello Harvey,

Did you get something about a PlaceBetRequest example and how to change the value of acceptBetterLine as well?

Thanks in advance

harveysburger commented 4 years ago

Hi, haven't had a chance to write some examples, on vacation now but next week I'll put something together

Eliakos commented 4 years ago

Hi, Great, I supposed you could be in vacation, then happy holidays. Do you go for a visit in a foreign country?

harveysburger commented 4 years ago

hey, nah nothing too exotic , stayed in my country :)

btw I submitted a simple example of how to place a bet. Nothing fancy the code just picks a random moneyline market and places a small bet on it.

I dont plan on writing any specific documentation for the wrapper since it just mimics almost everything from the Pinnacle API so the best is just relying on https://pinnacleapi.github.io/betsapi#operation/Bets_Straight to see what stuff means and what the various requests and responses have

Eliakos commented 4 years ago

Thank you Harvey, I will look into very soon. I would like to do it now but just too tired Thanks again

Eliakos commented 4 years ago

Hello Harvey, Thanks again for the update. I'm not used with linq, example here :

var eventsWithFullMatchMoneyLines = lines.Leagues.SelectMany(l => l.Events.Where(e => e.Periods.Any(p => p.Status == (int)PeriodStatus.Online && p.MoneyLine?.Home > 1.0m && p.Number == fullMatchPeriodNumber)) ).ToList();

But with debug, it helps to understand the intuitive parts. Less easier to understand p.Status == (int)PeriodStatus.Online && p.MoneyLine?.Home > 1.0m && p.Number == fullMatchPeriodNumber))

By "PeriodStatus", do you mean their lookups period number https://www.ps3838.com/static/index.php/en-us/help/api-user-guide-en-us#PeriodNumberLookup?

I found MoneyLine.Home (in our lines object structure) but what does mean p.MoneyLine?.Home > 1.0m?

About p.Number == fullMatchPeriodNumber) i think it corresponds to "periodNumber" in the doc, ie This represents the period of the match. For example, for soccer we have: 0 - Game 1 - 1st Half 2 - 2nd Half and we should this value equal to 0 as you did this to target for all sports <> soccer, right?

In the place bet request itself, we have WinRiskType = WinRiskType.Risk, and it's documented : winRiskStake | WIN_RISK_TYPE | Yes | Whether the stake amount is risk or win amount but i don't understand them well here, what does it means in your own words? I mean, you use the value Risk = 0, what does it implies against Win = 1?

What is the importance of UniqueRequestId = Guid.NewGuid()? Do i have to really care about that or submitting random is just the way to do it?