88APP_KEY=$1
99SESSION_TOKEN=$2
1010
11- HOST=https://beta- api.betfair.com
11+ HOST=https://api.betfair.com/exchange/betting
1212PORT=443
1313
1414# List all event types, providing app key and session token
@@ -31,7 +31,7 @@ function list_available_horse_races() {
3131 # get date now and format it
3232 local DATE=` date +" %Y-%m-%dT%TZ" `
3333
34- OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/listMarketCatalogue\" , \" params\" : {\" filter\" :{\" eventTypeIds\" :[$HORSE_RACING_EVENT_TYPE_ID ], \" marketCountries\" :[\" GB\" ],\" marketTypeCodes\" :[\" WIN\" ],\" marketStartTime\" :{\" from\" :\" $DATE \" }},\" sort\" :\" FIRST_TO_START\" ,\" maxResults\" :\" $MAX_RESULTS \" ,\" marketProjection\" :[\" RUNNER_DESCRIPTION\" ]}, \" id\" : 1}]" $HOST :$PORT /json-rpc`
34+ OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/listMarketCatalogue\" , \" params\" : {\" filter\" :{\" eventTypeIds\" :[$HORSE_RACING_EVENT_TYPE_ID ], \" marketCountries\" :[\" GB\" ],\" marketTypeCodes\" :[\" WIN\" ],\" marketStartTime\" :{\" from\" :\" $DATE \" }},\" sort\" :\" FIRST_TO_START\" ,\" maxResults\" :\" $MAX_RESULTS \" ,\" marketProjection\" :[\" RUNNER_DESCRIPTION\" ]}, \" id\" : 1}]" $HOST :$PORT /json-rpc/v1 `
3535 echo $OUT | json_reformat
3636}
3737
@@ -43,7 +43,7 @@ function list_runners() {
4343 # extract market id from prev. response
4444 MARKET_ID=` echo $OUT | cut -f10 -d " \" " `
4545
46- OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/listMarketBook\" , \" params\" : {\" marketIds\" :[\" $MARKET_ID \" ],\" priceProjection\" :{\" priceData\" :[\" EX_BEST_OFFERS\" ],\" exBestOfferOverRides\" :{\" bestPricesDepth\" :2,\" rollupModel\" :\" STAKE\" ,\" rollupLimit\" :20},\" virtualise\" :false,\" rolloverStakes\" :false},\" orderProjection\" :\" ALL\" ,\" matchProjection\" :\" ROLLED_UP_BY_PRICE\" }, \" id\" : 1}]" $HOST :$PORT /json-rpc`
46+ OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/listMarketBook\" , \" params\" : {\" marketIds\" :[\" $MARKET_ID \" ],\" priceProjection\" :{\" priceData\" :[\" EX_BEST_OFFERS\" ],\" exBestOfferOverRides\" :{\" bestPricesDepth\" :2,\" rollupModel\" :\" STAKE\" ,\" rollupLimit\" :20},\" virtualise\" :false,\" rolloverStakes\" :false},\" orderProjection\" :\" ALL\" ,\" matchProjection\" :\" ROLLED_UP_BY_PRICE\" }, \" id\" : 1}]" $HOST :$PORT /json-rpc/v1 `
4747 echo $OUT | json_reformat
4848}
4949
@@ -62,7 +62,7 @@ function place_bet() {
6262
6363 echo " Placing bet on : Selection Id: $SELECTION_ID , Side: $SIDE , Price: $PRICE , Size: $SIZE "
6464
65- OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/placeOrders\" , \" params\" : {\" marketId\" :\" $MARKET_ID \" ,\" instructions\" :[{\" selectionId\" :\" $SELECTION_ID \" ,\" handicap\" :\" 0\" ,\" side\" :\" $SIDE \" ,\" orderType\" :\" LIMIT\" ,\" limitOrder\" :{\" size\" :\" $SIZE \" ,\" price\" :\" $PRICE \" ,\" persistenceType\" :\" LAPSE\" }}],\" customerRef\" :\" $REFERENCE \" }, \" id\" : 1}]" $HOST :$PORT /json-rpc`
65+ OUT=` curl -s -X POST --header " Accept: application/json" --header " Content-Type: application/json" --header " X-Application: $APP_KEY " --header " X-Authentication: $SESSION_TOKEN " --data " [{ \" jsonrpc\" : \" 2.0\" , \" method\" : \" SportsAPING/v1.0/placeOrders\" , \" params\" : {\" marketId\" :\" $MARKET_ID \" ,\" instructions\" :[{\" selectionId\" :\" $SELECTION_ID \" ,\" handicap\" :\" 0\" ,\" side\" :\" $SIDE \" ,\" orderType\" :\" LIMIT\" ,\" limitOrder\" :{\" size\" :\" $SIZE \" ,\" price\" :\" $PRICE \" ,\" persistenceType\" :\" LAPSE\" }}],\" customerRef\" :\" $REFERENCE \" }, \" id\" : 1}]" $HOST :$PORT /json-rpc/v1 `
6666 echo $OUT | json_reformat
6767 # operation should return error as bet size is too small
6868 handleError $OUT
0 commit comments