A starter for Python

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

A starter for Python

Postby HiArt99 » Fri Sep 06, 2024 11:15 am

I was looking on the forum for help to access the COM interface using Python and the only post I found dated back to 2013. I have had a little play and here is a starter that may help Python developers. I hope to create a class that can be imported into a jupyter workbook and will post the file here if I accomplish something.

You need to install Pythonnet
Code: Select all
pip3 install pythonnet


Import clr
Add a reference to the BettingAssistantCom.dll
You can then import the ComClass
Finally, create an instance of the ComClass
Code: Select all
import clr

clr.AddReference("c:/Program Files (x86)/Betting Assistant/BettingAssistantCom.dll")

from BettingAssistantCom.Application import ComClass

ba = ComClass()


From here you can access the COM methods:
Code: Select all
user_name = ba.getUserName()

print (user_name)

sports = ba.getSports()

for s in sports:
    print(f'{s.sport} {s.sportId}')
If I get lost in thought it is because it is unfamiliar territory.
HiArt99
 
Posts: 68
Joined: Tue Aug 25, 2009 7:28 am

Re: A starter for Python

Postby Captain Sensible » Tue Sep 10, 2024 3:38 pm

Good luck with that endeavour, I learnt some python ages ago for my own bots using the API, never got round to using the COM options on BA because I didn't think it provided as many options as going direct to the API and wasn't clued up with VBA ,C etc. Been looking at brushing up my python again so I'll be watching with intrest as I'm sure the COM has come a long way since it was introduced.
User avatar
Captain Sensible
 
Posts: 2901
Joined: Sat Nov 19, 2005 2:29 pm

Re: A starter for Python

Postby HiArt99 » Thu Sep 26, 2024 10:13 am

Well, here we go with a few caveats.

    I am a c# (.net) programmer and python is a new language for me. Please excuse any non-python slip-ups.
    I cannot get getHorseForm to return horse form, but you can still use getMetaData to access this data
    I cannot get placeBets to return the bet Id for all the bets that it places.
    Still ToDo is event handling. I'll come back to this when I have some spare time
    WARNING: I had to add ".xlsm" to the file names to get around the Upload File filters. YOU MUST REMOVE this extension to use the files!
    All the unit testing code works on my PC.

I have included the jupyter notebook I used to test the calls to the 'BAHandler' class as this provides examples on how to use the interface.

More than happy for folks with more python experience than me to add or amend these files.

Hopefully, this gives the python folks a leg up to using the COM interface.

Arthur
Attachments
BettingAssistant_Test.ipynb.xlsm
The jupyter notebook
(56.48 KiB) Downloaded 47 times
BettingAssistant.py.xlsm
Contains the BAHandler class
(16.44 KiB) Downloaded 48 times
If I get lost in thought it is because it is unfamiliar territory.
HiArt99
 
Posts: 68
Joined: Tue Aug 25, 2009 7:28 am

Re: A starter for Python

Postby GaryRussell » Fri Sep 27, 2024 3:44 am

I'll have a look when I get chance to see if getHorseForm and placeBets are issues I need to resolve.
User avatar
GaryRussell
Site Admin
 
Posts: 9750
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK


Return to Discussion

Who is online

Users browsing this forum: No registered users and 24 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.

cron