VBNet Sample (Yes really)

Collapse
This is a sticky topic.
X
X
 
  • Time
  • Show
Clear All
new posts

  • jabe
    replied
    Originally posted by jabe View Post
    Well, that all sounds very logical, but when it picks up the last ssoid from a file and uses it to make a successful KeepAlive call, but then moments later a listCountries request fails with a "errorCode":"INVALID_SESSION_INFORMATION" message, it makes one wonder whether logic has any bearing on the situation. Perhaps I'll just go back to logging in every time, as before.
    Maybe I over-relied on the OK status. I've changed it to listCountries instead, and if the result is nothing, the LogInForm is conjured up.

    Leave a comment:


  • jabe
    replied
    I think I'd make the same assumptions you've made.

    Leave a comment:


  • SimonN
    replied
    Once you've got the MarketCatalogue, you can set the three SelectionIds as Home, Away, and Draw
    Thanks, Jabe.

    That's the thing, - that's an assumption we need to make because there's no real definitive way of knowing which team is Home and which team is away.

    So - going from ListEvent to MarketCatalogue to get Home and Away teams I was using the team name either side of ListEvent 'v' to link with the team names in MarketCatalogue but this is not possible because the name in ListEvent is not always the same as the name in MarketCatalogue and you cannot even do a contains because the home and away teams might contain the same names as in the case of the 'Sydney' example (See attached image).

    The only way to work here is to assume the first team listed in MarketCatalogue is always the team to the left of the ListEvent 'v' and the second team listed in MarketCatalogue is always the team to the right of the ListEvent 'v' which is just another way of saying the first team listed in MarketCatalogue is always the home team and the second team listed in MarketCatalogue is always the away team just as the Draw is always last in the sort order of the MATCH_ODDS runners coming from MarketCatalogue.

    I assume this is how Betfair itself lists MATCH_ODDS market with Home, Away and Draw runners always shown listed in that order.

    I can't think of any other way of doing it.

    Thank's bud.

    https://drive.google.com/open?id=0B-...ThDcmtuN1MxMUE
    Attached Files
    Last edited by SimonN; 08-10-2016, 01:04 PM.

    Leave a comment:


  • jabe
    replied
    Originally posted by SimonN View Post
    When retrieving football match selection ID's, must I go to MarketBook to find out which selection is Home, Away, and Draw or can I rely on the sort order in MarketCatalogue where the order seems given to be 1 - Home, 2 - Away, and 3 - The Draw?

    For example - I have the event ID fior this game but after that other than assuming sort orderis always home first how do I know which team is home and which away? Western Sydney v Sydney |
    Thank you
    Not sure about the sort order, but the runnerNames in the marketCatalogue are not Home, Away, Draw, but in the above case will be Western Sydney, Sydney, Draw. The way to link them is via the SelectionId. Once you've got the MarketCatalogue, you can set the three SelectionIds as Home, Away, and Draw, and then I'd be inclined to loop through the three MarketBook options till you get a match on SelectionId. Could you assume the MarketBook runner data always comes in the same sequence? I suppose you could, but it sounds like the kind of thing that will work a million times and mess up all your assumptions on the next one. I'd take another nanosecond and be certain.

    Leave a comment:


  • SimonN
    replied
    When retrieving football match selection ID's, must I go to MarketBook to find out which selection is Home, Away, and Draw or can I rely on the sort order in MarketCatalogue where the order seems given to be 1 - Home, 2 - Away, and 3 - The Draw?

    For example - I have the event ID fior this game but after that other than assuming sort orderis always home first how do I know which team is home and which away? Western Sydney v Sydney |
    Thank you
    Last edited by SimonN; 08-10-2016, 05:14 AM.

    Leave a comment:


  • jabe
    replied
    Originally posted by jabe View Post
    Has anyone successfully logged out? I've just changed my LogIn procedure so that it tries to do a KeepAlive with an ssoid saved in a file first, and if that works it doesn't bother trying to LogIn, but assumes it's still got an active session with that ssoid. So that'll save me logging in multiple times (and having multiple logged in sessions, if that really is a thing).

    I've just retried the LogOut code in my program and it runs and returns status = OK, but if I stop my program, it will just go straight back in and carry on as if nothing had happened. So LogOut doesn't do any such thing. I'm not concerned, but it seems odd.
    Well, that all sounds very logical, but when it picks up the last ssoid from a file and uses it to make a successful KeepAlive call, but then moments later a listCountries request fails with a "errorCode":"INVALID_SESSION_INFORMATION" message, it makes one wonder whether logic has any bearing on the situation. Perhaps I'll just go back to logging in every time, as before.

    Leave a comment:


  • SimonN
    replied
    Terrific, thank you, Jabe. Where's the comment like icon! Cheers.

    Leave a comment:


  • jabe
    replied
    [QUOTE=SimonN;13973]Anyone instruct me or else provide code on how to login in VBA using certificate?

    Thank you.

    Si[/]

    Hi Simon

    This thread from the VB6 and Excel forum might help - looks like someone sorted it out on there.

    http://forum.bdp.betfair.com/showthread.php?t=2491

    Leave a comment:


  • SimonN
    replied
    Anyone instruct me or else provide code on how to login in VBA using certificate?

    Thank you.

    Si

    Leave a comment:


  • jabe
    replied
    Has anyone successfully logged out? I've just changed my LogIn procedure so that it tries to do a KeepAlive with an ssoid saved in a file first, and if that works it doesn't bother trying to LogIn, but assumes it's still got an active session with that ssoid. So that'll save me logging in multiple times (and having multiple logged in sessions, if that really is a thing).

    I've just retried the LogOut code in my program and it runs and returns status = OK, but if I stop my program, it will just go straight back in and carry on as if nothing had happened. So LogOut doesn't do any such thing. I'm not concerned, but it seems odd.

    Leave a comment:


  • jabe
    replied
    Quotes are used in VB.Net to define the start and end of a string, like this

    dim aString = "some text"

    If you want to include a quote in the string, you need to double it so that the compiler/editing interface understands what you've written. If you wrote

    dim anotherString = "this symbol " is a quote"

    the " after the word symbol could be interpreted as the end of the string, and then it doesn't know what to do with

    is a quote "

    because it's just some pointless test that you've written.

    So the reason for double quotes is to allow one quote to appear mid-string.

    dim aThirdString = "this symbol "" really is a quote"

    So, because I wanted to use the JSON string you mentioned, I double all the quotes that needed to remain within the string.

    Leave a comment:


  • LordRom
    replied
    so having unistalled nuget package manager and reinstalled i have now got it working.

    many thanks


    EDIT:-

    So what you said worked, but still not within my app. Given that I'm a json f'wit, can you explain why you turned " into ""?

    Why I use http://www.jsonlint.com/ my returned values from BF seem to work with single quotes.

    Code:
    {
    	"jsonrpc": "2.0",
    	"result": [{
    		"marketId": "1.127379402",
    		"isMarketDataDelayed": false,
    		"status": "OPEN",
    		"betDelay": 0,
    		"bspReconciled": false,
    		"complete": true,
    		"inplay": false,
    		"numberOfWinners": 1,
    		"numberOfRunners": 6,
    		"numberOfActiveRunners": 6,
    		"totalMatched": 0.0,
    		"totalAvailable": 2242.66,
    		"crossMatching": true,
    		"runnersVoidable": false,
    		"version": 1453499385,
    		"runners": [{
    			"selectionId": 11837662,
    			"handicap": 0.0,
    			"status": "ACTIVE",
    			"totalMatched": 0.0,
    			"ex": {
    				"availableToBack": [{
    					"price": 3.65,
    					"size": 40.0
    				}, {
    					"price": 3.55,
    					"size": 40.0
    				}, {
    					"price": 3.45,
    					"size": 17.14
    				}],
    				"availableToLay": [{
    					"price": 60.0,
    					"size": 4.57
    				}],
    				"tradedVolume": []
    			}
    		}, {
    			"selectionId": 8534426,
    			"handicap": 0.0,
    			"status": "ACTIVE",
    			"totalMatched": 0.0,
    			"ex": {
    				"availableToBack": [{
    					"price": 5.3,
    					"size": 31.03
    				}, {
    					"price": 5.1,
    					"size": 28.42
    				}, {
    					"price": 1.63,
    					"size": 18.73
    				}],
    				"availableToLay": [{
    					"price": 60.0,
    					"size": 4.57
    				}],
    				"tradedVolume": []
    			}
    		}, {
    			"selectionId": 10476869,
    			"handicap": 0.0,
    			"status": "ACTIVE",
    			"totalMatched": 0.0,
    			"ex": {
    				"availableToBack": [{
    					"price": 5.8,
    					"size": 26.04
    				}, {
    					"price": 5.6,
    					"size": 29.14
    Last edited by LordRom; 05-10-2016, 06:24 PM.

    Leave a comment:


  • LordRom
    replied
    So I can't install json.net as you describe due to some error, but having added the code/form 2 to the current project and ran it still falls over at the same place.

    So will try to see why I can't install json.net via manage nuget packages and see if i can make it work once ive solved that one. It's clearly something to do with that installation.


    Thanks for your help.

    Leave a comment:


  • jabe
    replied
    I'll have to let someone else answer that!

    Leave a comment:


  • SimonN
    replied
    It's true though that I don't have to renew certificate upon password change?

    I ask because after password change the Python certificated session request came back with a PASSWORD_CHANGE_PENDING status or words to that effect.

    I thought - oh no surely I dont have to recreate certificate every time I change password?

    Leave a comment:

Working...
X