Announcement

Collapse
No announcement yet.

Basic connection for c#, not console

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bfexplorer
    replied
    There are quite a lot of differences in both samples. My code is simple app loading all races and updating market data every 1 second, including bets placed on a market. My sample code includes 27 already build strategies you can execute. The same code is used in my full app:

    Bfexplorer.png

    The difference in my approach when programming strategies is that you do not have to program any betfair api call, all that is already included in the app backend code. On the screenshot above you can see that I have got 142 different strategies programmed for my use. Any such strategy code is parametrized, so one strategy can be configured different way. You can see that on the screenshot, there is My Strategies to Execute view with added strategies.

    When developing a strategy you really just code strategy code, and so development of strategy code is very simple, and not so time consuming. App is able to load your strategy, so you have got two option, you can build everything yourself, including simple user interface like I showed on my simple winform app. Or build just strategy code, and use bfexplorer app like user interface for your custom built strategies.

    The code looks like this one from bot sdk:

    BotCode.png

    https://github.com/StefanBelo/Bfexpl...MyMarketBot.cs

    This is just simple code you can add your features to, when the strategy above is executed in bfexplorer app, it reports Total matched volume on the market. the line 45.

    Leave a comment:


  • bfexplorer
    replied
    This is public forum, so anything discussed here can be helpful for other betfair developers.

    I have build geoff sample code, here is the screenshot:

    ApiSample.png

    My sample app looks like this:

    MyApiSample.png

    Leave a comment:


  • BertrumGlut
    replied
    Thanks again for your replies. I was aware of the £299 activation fee which I'm fine with. The strategy will either work or it won't. Stefan I didn't realise you charge a subscription and I don't know what that is but agree that it's a reasonable approach and again, if what I do works then that would be fine.

    In my case, I'm keen to understand the coding myself and I'm immensely grateful to you both for taking time out and sharing your knowledge. I've downloaded Geoff's win forms application from the other thread and am stepping through that. I'm learning a lot about API calls which wasn't around when I was doing VB6.

    Neither of you needed to reply, yet you did, and someone you don't know is genuinely grateful for your help and guidance. Many thanks.
    Last edited by BertrumGlut; 22-05-2022, 08:09 PM.

    Leave a comment:


  • bfexplorer
    replied
    BertrumGlut, to get betfair api access your account must be granted such api access, if you want to use your own way, then yes you must pay betfair 299 GBP, it is said on their web page:

    https://developer.betfair.com/

    Activation fee 299 GBP

    If you want to use my code, then you can get activation of api access when installing my app and login to betfair, all is done automatically. Then you can use my app, and as well any code in my bot sdk:

    https://github.com/StefanBelo/Bfexplorer-BOT-SDK

    You can use my app for free in trial, then you can subscribe to get support.

    For some people working with me on betfair strategies, or just sharing anything on betfair or machine learning I give free access, but that is what friends do.
    Last edited by bfexplorer; 22-05-2022, 01:46 PM.

    Leave a comment:


  • geoffw123
    replied
    I dont know, I assumed you have to purchase a subscription to BfExplorer first and then you can run the script files on top of that. I could be wrong though, its nothing to do with me.

    If you go your own route of write everything yourself, that path is painful also as Betfair now charge £300 for a non delayed API key.

    Leave a comment:


  • BertrumGlut
    replied
    Is that solution/path free of charge, I assumed it wasnt ?

    That could be why I'm getting nowhere with it :-)

    Leave a comment:


  • geoffw123
    replied
    hi

    No problem, yeah can get complicated. Is that solution/path free of charge, I assumed it wasnt ? I have posted a simple Project now to a new message thread anyways.

    Geoff

    Leave a comment:


  • BertrumGlut
    replied
    Thank you Geoff. I'm looking at Stefan's code but am gettinng bogged down with using statements, references, NuGet, etc. All really good learning for me.

    Leave a comment:


  • geoffw123
    replied
    Hi

    I started re-jigging the console example as a small Windows demo, I fixed the couple of bugs in the console version and hopefully improved it a little bit, e.g, a login form so you dont have to faff around generating a session token manually. Its taking me a bit longer than I thought to complete and I have run out of time for now, so will finish it and post it in the near future. I will post it as a new thread just to make it easier to find if anyone finds it useful in the future.

    Geoff

    Leave a comment:


  • BertrumGlut
    replied
    Sorry I just re-read Geoff's comment and I think I was vague in my response. The page I used was here -

    https://developer.betfair.com/en/get.../#exchange-api

    It takes you to a page that (I assume) BF set up and then you get to see just one market but it confirms your AppKey and Session ID.

    Leave a comment:


  • BertrumGlut
    replied
    Geoff - for the AppKey and Session ID I followed the instructions from BF and the page where you just get one market (I think). For me, it's the API connections that I don't know how to do and am trying to learn. I'm OK with coding generally but APIs are new to me, as is a lot of the C# nomenclature - I'm self taught in C#.

    Stefan - thanks for your further information and you're absolutely right in that I didn't understand your first paragraph! I don't yet know what swagger is and haven't use git hub before but that's all down to me to learn, which I'll do in time.

    Thanks so much as well for your further information - I'll focus on the MainForm.cs and your instructions as above.

    Appreciate I'll have a lot of coding to do for trading but once I get the relevant connections I can plough through that. If and when I get it robust enough I'll also post my code on here so others could potentially benefit - keen to return in some part the help that you've given me.

    Leave a comment:


  • bfexplorer
    replied
    BertrumGlut

    Betfair sample code is just rest api wrapper code for communication with api in C#, I do not know why betfair did not make swagger definition of their rest api, so then client code could be generated for any programming language, the code they manually programmed. Yes, they make swagger definition for streaming api, but the problem is that swagger is not able to generate client code for streaming, you can use it to auto generate data transfer objects or models only.

    I am not quite sure if you understand what I have said above so here is example of what I have explained.

    Here there is my code in VB showing how to use streaming api in Visual Basic:

    https://github.com/StefanBelo/Bfexpl...iVB/Program.vb

    Basically what happens is to login to betfair api, on line 46, then subscribing to horse racing markets on line 63. Subscribing of market updates means that you will get automatically populated data of markets and their prices, you will get Market objects and all data available through api. It is done quite a lot of magic here from your point of you. Using just betfair api wrapper code you would have to call a lot of different api calls to get market catalogue data then prices (market book in rest api), just put the break point on the line 24, and browse market data in VS.

    Well yes, you will get api client code working, but what is your goal then? I think to automate your betting or trading on betfair markets, and that requires a lot of coding.

    The difference in my code base is that my bot sdk is not just api client wrapper, it is framework with already built infrastructure.

    In my bot sdk there is winform sample code in C# presenting the use of the framework in the simple app covering all features you need:

    https://github.com/StefanBelo/Bfexpl...UI/MainForm.cs

    The code implements login to betfair, populating market data, in this case app loads all horse racing markets for a day, updating market data automatically, executing preprogrammed strategies, and so on.

    App uses practice mode so no bets are placed on betfair when bot strategy is executed, but if you place real bets then bet data are populated for you automatically as well.

    The same BOT SDK code is used to build my desktop app, this one:

    http://bfexplorer.net/Products/Bfexplorer
    ​​​​​​​
    Last edited by bfexplorer; 17-05-2022, 08:01 AM.

    Leave a comment:


  • geoffw123
    replied
    Hi
    I hadnt looked at this example code for years, so downloaded it this afternoon for a quick peruse, see if it had changed much. I got it working OK pretty quickly but something about it is puzzling me. I will post as a separate message thread here, so hopefully tech support might notice it and reply.

    P.S how did you get your AppKey and SessionToken for pasting into the Console Demo ? You seem to have already figured out the most tricky part
    Last edited by geoffw123; 15-05-2022, 07:26 PM.

    Leave a comment:


  • BertrumGlut
    replied
    Thanks Stefan, I'll hunt through those now for a windows or non-console way of connecting. Appreciate the fast response.

    Geoff, I've just managed to get the console app working now. At least, I can save log in details but I'm not sure what to do with the other commands. However, if I can just get the connection from windows then I should be good to step through the properties to work what I need to send from there.

    Many thanks both for your quick replies.

    Leave a comment:


  • geoffw123
    replied
    Did you manage to get the Betfair C# console App up and running OK, that wasnt clear to me in your post ?

    Leave a comment:

Working...
X