Hello,
I have started looking at the API. I am looking at the UK to win horse racing market. I have created a method, got my live API and able to place individual bets.
I have the bets and the selection ID in a dataframe. I want to pass these to a function which will place these bets on the selection ID using a for loop. This looks like this:
def placeFailingBet(marketId, selectionId, size):
if( marketId is not None and selectionId is not None):
print ('Calling placeOrder for marketId :' + marketId + ' with selection id :' + str(selectionId))
place_order_Req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"' + marketId + '","instructions":'\
'[{"selectionId":"' + str(
selectionId) + '","handicap":"0","side":"BACK","orderType":"LIMIT ","limitOrder":{"size":' \
+ str(size) + ',"price":"1.50","persistenceType":"LAPSE"}}],"customerRef":"test12121212121"}, "id": 1}'
"""
print(place_order_Req)
"""
place_order_Response = callAping(place_order_Req)
place_order_load = json.loads(place_order_Response)
I then call the function like so:
size = df['size'].astype(str)
size = '"' + size + '"'
size = size
for i, j in zip(size, selectionId):
placeFailingBet(marketId = marketId, selectionId = j, size = i)
This will place a bet but only for the first row. I want it to place a bet for all the rows in the dataframe.
Any help would be great cheers,
Sandy
I have started looking at the API. I am looking at the UK to win horse racing market. I have created a method, got my live API and able to place individual bets.
I have the bets and the selection ID in a dataframe. I want to pass these to a function which will place these bets on the selection ID using a for loop. This looks like this:
def placeFailingBet(marketId, selectionId, size):
if( marketId is not None and selectionId is not None):
print ('Calling placeOrder for marketId :' + marketId + ' with selection id :' + str(selectionId))
place_order_Req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"' + marketId + '","instructions":'\
'[{"selectionId":"' + str(
selectionId) + '","handicap":"0","side":"BACK","orderType":"LIMIT ","limitOrder":{"size":' \
+ str(size) + ',"price":"1.50","persistenceType":"LAPSE"}}],"customerRef":"test12121212121"}, "id": 1}'
"""
print(place_order_Req)
"""
place_order_Response = callAping(place_order_Req)
place_order_load = json.loads(place_order_Response)
I then call the function like so:
size = df['size'].astype(str)
size = '"' + size + '"'
size = size
for i, j in zip(size, selectionId):
placeFailingBet(marketId = marketId, selectionId = j, size = i)
This will place a bet but only for the first row. I want it to place a bet for all the rows in the dataframe.
Any help would be great cheers,
Sandy


Comment