C# a Step by Step Beginners Tutorial

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

  • Escapee
    replied
    Originally posted by osa_dev View Post
    Escapee please take a look at my form:



    I have some issues with correct Market time. As you can see every market besides horse racing has start hour set at 01:00, is that correct?

    Also in box Last Updated only seconds part is changing and only in the range of last 10 seconds. Minutes and hours don't update at all.

    I got some problems with my regional setting on windows as I needed to change decimal sign from ',' to '.' so maybe I should also correct somehow my date/hour settings in windows to fix those minor issues in software.

    I am just fresh newbie in C# and BF Api.

    Kind regards
    Osa_dev

    Edit:

    I would also like to ask if it is possible to place multiples e.g. on soccer match odds via API?

    The issue may also be something to do with the 'Locale' setting on the computer ( not using summer time ? ).
    You can either google for hours to try and sort it out or do a quick fix in the MenuTreeNode class:
    change
    Code:
     if( mktSum.startTime.ToLocalTime().ToString( "HH:mm" ) != "00:00" )
    to
    Code:
    if( mktSum.startTime.ToLocalTime().ToString( "HH:mm" ) != "[COLOR="Red"]01:00[/COLOR]" )

    Also I notice in your picture, the ODDS on your market are in the wrong font, have you missed out a step in the tutorial where the oddsFont is set ?

    Leave a comment:


  • Escapee
    replied
    Originally posted by maniw4 View Post
    Hi Escapee,

    following my earlier post, i did a debug of the program to investigate the problem with the AUS/NZ horse racing. All i can see is that your program is displaying the correct values returned from Betfair, which means for some reason Betfair is sending random stuff for the AUS/NZ races.

    I selected one race the 3:13 Canb(AUS) and looked into the marketResp variable in the LoadNewMarket function - all the information was incorrect for the race and there were no runners! When i logged into my normal Betfair account i could see the race information, there were 7 runners.

    Perhaps there is another interface for the AUS/NZ racing. Maybe i need some funds in the AUS wallet to get the correct info back from Betfair.

    Anyway, your program is working correctly as far as i can tell.
    Due to complicated reasons, betfair split off its Austrailian/NZ markets to a seperate Austrailian exchange.
    For reasons of simplicity, This tutorial only access's the NON-AUS ( i.e. rest of world ) exhange so when you try to access an Austrailian market with it, you'll get zero or incorrect information.


    I could look at adding functionality to access to AUS markets. Its probably just a matter of testing for which exchange a market is on and then setting the end point URL.

    Also, for simplicity, "Asian-Line Markets" are not catered for in this tutorial.

    Leave a comment:


  • Escapee
    replied
    Originally posted by osa_dev View Post
    I got the same problem. It is because local decimal sign was set to ',' instead of '.'

    Btw great tutorial, thank you for your time spent on us newbies
    Aha.. that would explain it, variations due to 'Locale' setting on the computer.

    I don't know much about coding for for all location variations as I've never needed to.
    The stuff I've read about it seems to make the code very verbose and bloated so I don't bother with it, especially for a tutorial like this where simplicity and clarity is a large requirement.

    Leave a comment:


  • osa_dev
    replied
    Escapee please take a look at my form:



    I have some issues with correct Market time. As you can see every market besides horse racing has start hour set at 01:00, is that correct?

    Also in box Last Updated only seconds part is changing and only in the range of last 10 seconds. Minutes and hours don't update at all.

    I got some problems with my regional setting on windows as I needed to change decimal sign from ',' to '.' so maybe I should also correct somehow my date/hour settings in windows to fix those minor issues in software.

    I am just fresh newbie in C# and BF Api.

    Kind regards
    Osa_dev

    Edit:

    I would also like to ask if it is possible to place multiples e.g. on soccer match odds via API?
    Last edited by osa_dev; 03-08-2012, 10:56 PM.

    Leave a comment:


  • maniw4
    replied
    Hi Escapee,

    following my earlier post, i did a debug of the program to investigate the problem with the AUS/NZ horse racing. All i can see is that your program is displaying the correct values returned from Betfair, which means for some reason Betfair is sending random stuff for the AUS/NZ races.

    I selected one race the 3:13 Canb(AUS) and looked into the marketResp variable in the LoadNewMarket function - all the information was incorrect for the race and there were no runners! When i logged into my normal Betfair account i could see the race information, there were 7 runners.

    Perhaps there is another interface for the AUS/NZ racing. Maybe i need some funds in the AUS wallet to get the correct info back from Betfair.

    Anyway, your program is working correctly as far as i can tell.

    Leave a comment:


  • maniw4
    replied
    Originally posted by Escapee View Post
    maniw4
    nice one. its good to see so many people have completed the project so far.
    I couldn't see anything wrong with your 'last updated', it looks fine to me.
    Hi Escapee,
    The actual time was 6pm in the evening and it was 8 hours behind. My Locale was set wrong to gmt-8.

    Anyway i think there may be another issue because when i click on some races the wrong information is brought back. i've only seen this with AUS/NZ races on todays race card - see attached pics.

    I'll dig in to this a bit more and see if i can give you some more info.

    pic1
    [IMG][/IMG]

    pic2
    [IMG][/IMG]

    Leave a comment:


  • osa_dev
    replied
    Originally posted by Escapee View Post
    Rui Rodrigues
    [I]


    maxxim
    "Hello! Please help me, why this exception pops up?"
    The error would indicate that there is something in that field ( rDataArr[3] ) that is not a number.
    Next time it happens, examine the contents of rDataArr[3].
    If you still can't work it out then post up the content of runnerArr[0] and rDataArr[3] when it happens.
    I got the same problem. It is because local decimal sign was set to ',' instead of '.'

    Btw great tutorial, thank you for your time spent on us newbies

    Leave a comment:


  • Escapee
    replied
    maniw4
    nice one. its good to see so many people have completed the project so far.
    I couldn't see anything wrong with your 'last updated', it looks fine to me.

    Leave a comment:


  • maniw4
    replied
    Thanks Escapee. Dont know why the "Last Updated" is showing the wrong time, i must have botched a step somewhere!

    free image hosting


    EDIT
    I found the problem with the time - my System Locale was set wrong.
    Last edited by maniw4; 01-08-2012, 09:00 PM.

    Leave a comment:


  • Escapee
    replied
    AzureGulf
    Very neat concept, but how does the user see each of the "new UCM Market objects"?




    here's a real world example of a 1-1-Many->Many model

    Football Fixtures have many markets, goal of program is to Autobet on the OverUnder Markets for each fixture, many fixtures concurrently.

    Object Model = FORM-LISTBOX-FIXTURE-OUMARKET, in a 1-1-Many-Many configuration.

    a Fixture Object hosts an array of Market Objects which are related, so we are going to mount the refresh and automated betting threads at the Fixture Object Level.

    1) a Listbox instead of a MenuTree to hold all todays Fixtures

    2) a Fixuture Object and all encapsulated sub objects are mounted on a UserControl ( what I refered to in previous post as the 'UserControlMarket' UCM for a single CorrectScore Market. But in this case it holds 1 Fixture->many Markets )
    Here is the UserControl Fixture Object (UCF)


    3) a TableLayoutPanel to hold and display multiple UCF objects.
    This will just scroll the UCF objects like a DataGridView when there is not enough screen real estate to display all of them.
    So now our form looks like this


    when you wire it all together you get something like this, which can automatically bet on 100's of markets simultainiously.

    ( reduced in size so as not to give away all the secrets )



    And its all done using the same 'model' as outlined in this tutorial

    hope that helps.


    If its still a bit to much, I'm always on the look out for interesting and mutually benefitial collaborations

    Leave a comment:


  • AzureGulf
    replied
    Originally posted by Escapee View Post
    Drifter

    if you understand what I'm imagining then you have converted the tutorial model of 1-1-1 objects to 1-1-many objects.
    Hi Escapee

    Very neat concept, but how does the user see each of the "new UCM Market objects"?

    BTW, I've finally written my first small database using Entity Framework (EF) adapted around your earlier Menu foundation so that Prices and Amounts Available for Runners can be persisted ...

    (EF is a very neat product - I'm using its Model First methodology in EF 4 and SQL Server Compact Edition 4.0)

    I know that this has been a (major) digression from your tutorial, but please be assured that I am keeping up with your posts and often refer to them as part of my ongoing but slow learning process - looking forward to whatever comes next

    Leave a comment:


  • Escapee
    replied
    Drifter

    If I understand you correctly ?! You could do it that way but, imho, its a bit hmmmmm...... wrong.

    If I understand you correctly, I visualised the whole structure in a couple of minutes but conveying it to you is the hard part !

    Its considered 'wrong approach' in that in a nutshell: its losing 'Object Orientation' double quick time and misusing resources.

    I think you're thinking about it wrong.


    then I tried to explain it, wrote a few lines, failed to be consise and explanitory, deleted, rinse and repeat 5 times, 30 minutes got nowhere.....


    try this, think of the current model as 3 components:
    1) a MENU ( could be a ListBox etc )
    2) a MARKET ( including market refresh, display, and any bets & automated betting )
    3) a FORM ( an 'object' holder, its holding the market and the menu )

    now change that word component to OBJECT
    think of the current model as 3 OBJECTS

    The current model in this tutorial the MENU object reuses the MARKET object because its simple and it replicates betfairs web page.
    The maket object is mounted on the form, but doesn't have to be.

    1) Create a usercontrol class and mount all the stuff related to a single market on it. The Market Mem, the Refresh, the display, all of it.
    This is called "UCM"

    2) use a TableLayOutPanel or any of 50 standard controls to hold and display your multiple "UCM"s

    3) Now change your MENU object so that it creates a new "UCM" MARKET object instead of reusing the same one.

    4) Once you can do it all manually you just have to write a small thread to control the MENU and the rest just takes care of itself.


    if you understand what I'm imagining then you have converted the tutorial model of 1-1-1 objects to 1-1-many objects.


    so simple to do so hard to explain.

    over an hour on this I got to stop.
    Last edited by Escapee; 31-07-2012, 12:05 AM.

    Leave a comment:


  • Drifter
    replied
    Would I be right in thinking that in order to cycle through a group of events, it would just be necessary to change the mID in the call public bool GetMarket(ref GetMarketResp marketResp, int mID) [and other related calls] in CBetfairAPI class?

    What I would look to do is build an array of eventID's which the refresh code cycles through repeatedly. I have something similar in my own code, though it lacks the threading and event handling.

    So far I haven't tried to display this data (essentially from all correct scores events on a class of football match, eg Premiership, bundesliga etc.), choosing to just do a bunch of calculations in the background and display text strings of the results - but your approach makes me think a few logic tweaks in your interface code could do it. Do you have any comments on this approach?

    Leave a comment:


  • Escapee
    replied
    Rui Rodrigues
    "Got everything working just fine and now will study and explore possibilities. Have one question though (so far), sometimes I get prices like 42 and the real price is 4.2 but other times all is fine, what could be the problem? decompressing prices? parsing the markets string?"

    Hmmm, not sure why that should be unless its a coincidence caused by the X-Matching Bots synthetic prices ( see this thread )

    is it consistent ? ( i.e. does it give 42 every refresh ? ) if so then in the UpdateMarketPricesCompressed() function, put a break point in and examine the contents of the data in BackPricesArr or LayPricesArr after these statements have executed.
    Code:
                        string[] BackPricesArr = runnerArr[1].Split( '~' );
                        string[] LayPricesArr = runnerArr[2].Split( '~' );
    If it still looks like an error with the decimial point could you post up the data and a screen shot of betfairs prices


    maxxim
    "Hello! Please help me, why this exception pops up?"
    The error would indicate that there is something in that field ( rDataArr[3] ) that is not a number.
    Next time it happens, examine the contents of rDataArr[3].
    If you still can't work it out then post up the content of runnerArr[0] and rDataArr[3] when it happens.

    Leave a comment:


  • maxxim
    replied
    Hello! Please help me, why this exception pops up?

    Last edited by maxxim; 26-07-2012, 09:18 PM.

    Leave a comment:

Working...
X