Integrate ProphetX Prices into Existing Price Screen
Integrate ProphetX order flow into your price screen platform by ingesting event and market data, managing user sessions, running geolocation checks, submitting orders, and sending tracking data.
Integrate ProphetX Order Flow into Your Existing Price Screen Platform
High-Level Steps
- Ingest Event and Market Data
- Manage User Sessions
- Geolocation Check
- Submit Orders
- Certify with ProphetX
Notes
- The current API documentation is limited. We will continue updating it to keep it current.
- This guide covers order submission only. To manage orders and review order history, users must log in to the website or use the mobile app.
Ingest Event and Market Data
Ingest events and markets using the Market Data API. Record the strike_id, because it is required when you submit an order. Market Data API documentation: Market Data API Documentation
Recommended steps:
- Get production Market Data API token from ProphetX if you do not have one yet.
- Call
get_sport_eventsto get a list of events of a tournament. - Call
get_multiple_marketsto get markets for a list of events. Record thestrike_id, because it is required later when you submit orders.
{
"data": {
"10073803": [
{
"display_name": "Total Runs",
"id": 258,
"strike": 7.5,
"name": "Fixed total 7.5",
"selections": [
{
"display_strike": "7.5",
"display_name": "under 7.5",
"display_price": "+119",
"strike": 7.5,
"strike_id": "40a32ae7b39684d430cf494be26cbe6b",
"name": "under 7.5",
"price": 119,
"outcome_id": 13,
"quantity": 42.81,
"updated_at": 1728663193784820000,
"value": 32.61
},
{
"display_strike": "7.5",
"display_name": "over 7.5",
"display_price": "-122",
"strike": 7.5,
"strike_id": "7d8bbf46022a2329f792a2e0dfb18408",
"name": "over 7.5",
"price": -122,
"outcome_id": 12,
"quantity": 32.46,
"updated_at": 1728659738559788000,
"value": 39.6
}
],
"type": "total"
},
......,
{
"display_name": "1st-5th Inning Spread",
"favourite": true,
"id": 275,
"strike": -0.5,
"name": "Fixed home -0.5",
"selections": [
{
"competitor_id": 10000001,
"display_strike": "-0.5",
"display_name": "Los Angeles Dodgers -0.5",
"display_price": "+103",
"strike": -0.5,
"strike_id": "5cfa3fd055082c25448ed0bdee083092",
"name": "Los Angeles Dodgers -0.5",
"price": 103,
"outcome_id": 1714,
"quantity": 702.05,
"updated_at": 1728662243408684000,
"value": 681.6
},
{
"competitor_id": 10000033,
"display_strike": "+0.5",
"display_name": "San Diego Padres +0.5",
"display_price": "-111",
"strike": 0.5,
"strike_id": "48470acfbf067d1dc8c76d4692315c34",
"name": "San Diego Padres +0.5",
"price": -111,
"outcome_id": 1715,
"quantity": 13.89,
"updated_at": 1728662243408817000,
"value": 15.42
}
],
"type": "spread"
}
]
}
}Manage User Session
This flow does not require you to store the user’s email and password, but the user must re-enter those credentials once every 30 days.
Recommended steps:
- Open a modal and ask the user to enter their ProphetX email and password.
- Call
https://cash.api.prophetx.co/api/v1/auth/loginwith the user-provided email and password to retrieve two tokens:accessTokenandrefreshToken. TheaccessTokenexpires within 1 hour, and therefreshTokenis valid for 30 days. Store both tokens on your server. - When
refreshTokenexpires, callhttps://cash.api.prophetx.co/api/v1/auth/extend-sessionto get a newrefreshTokenby using theaccessToken. In the request, useBearer <previous refreshToken>in theAuthorizationheader. A validrefreshTokenis required to submit orders. - If 30 days have passed since the
accessTokenwas created, or if your platform fails to get a newrefreshTokenby using the existingaccessToken, ask the user to repeat step 1.
Geolocation Check
Implement the geolocation check as follows.
Minimum Integration Example
// Include Solus into your page and Initialize the GcHtml5 instance
<script src="https://cdn.geocomply.com/path/to/gc-html5.js" type="text/javascript"></script>
<script type="text/javascript">
var geoClient = GcHtml5.createClient();
</script>// AMD / RequireJS application can do it this way
define(['gc-html5'], function(GcHtml5) {
var geoClient = GcHtml5.createClient();
});
// Setting up the parameters
geoClient.setUserId("user_identifier");
// Setting up the license string
geoClient.setLicense("license_string");
// Register events handler
geoClient.events.on('engine.success', function(text, xml) {
// Process the response XML
})
.on('engine.failed', function(code, message) {
// Handle errors
});
// Request Geolocation
geoClient.request();Geocomply integration example:
- Replace the
srcvalue in the example above withhttps://cdn.geocomply.com/224/gc-html5.js - Call
https://cash.api.prophetx.co/api/v1/geocomply/license?isSecure=trueto get a Prophet license. This is a one-time license, and you need to get a new one for each geolocation request. - Call
https://cash.api.prophetx.co/api/v1/meto get the user ID. - Use the code examples above to run the geolocation request with the user ID and license from steps 2 and 3.
- After you receive a response, call
https://cash.api.prophetx.co/api/v1/geocomply/decryptto retrieve the decrypted response and ProphetX-specific validation logic. - Confirm that
<error_code>0</error_code>and"isActiveStates": true. If both values are present, the user is allowed to submit an order. Otherwise, geolocation failed, and your platform should prompt the user to trigger the geolocation request again.
{"text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<nodes>
<gc_transaction>8b21cb1d4e54d0de</gc_transaction>
<error_code>0</error_code>
<error_message/>
<sdk solution=\"Solus\" os=\"Mac\"/>
<geolocate_in>1800</geolocate_in>
<buffer_time>35</buffer_time><conn_type>static</conn_type>
<mac_address>unknown</mac_address>
<device_uuid>1726663819576–07167EAD-AC76–4DCC-854C-CBCB40926D25</device_uuid>
<ip ipaddress=\"45.122.19.131\" proxyscore=\"0.00\" lat=\"41.8108\" lon=\"-71.3667\" acc=\"100000\" country_code=\"US\" country=\"United States\" region_code=\"NY\" region=\"New York\"
city=\"Huntington Station\" err=\"0\" secondary=\"1\"/><wifi lat=\"40.82496\"
lon=\"-71.45789\" acc=\"33.145748641574\" country_code=\"US\"
country=\"United States\" region_code=\"NY\" region=\"New York\"
city=\"\" street=\"Main Street\" err=\"0\" primary=\"1\"
dist_to_border=\"31591.854251358\"/><gsm lat=\"\" lon=\"\" acc=\"\"
country_code=\"\" country=\"\" region_code=\"\" region=\"\"
city=\"\" street=\"\" err=\"202\"/><gps lat=\"\" lon=\"\"
acc=\"\" country_code=\"\" country=\"\" region_code=\"\"
region=\"\" city=\"\" street=\"\" err=\"202\"/>
<user_id>78d76eaf-3227–4045–8c6a-5e6fa3cc8a26</user_id>
<reason>Verfiy geo location</reason><user_session_id/>
<custom_fields>
<custom_field id=\"email\">[email protected]</custom_field>
<custom_field id=\"phoneNumber\">2348232834</custom_field>
</custom_fields><timestamp>2024–09–30T15:00:52.672Z</timestamp>
<akey>ProphetXProd</akey></nodes>\n",
"isActiveStates": true,
"errorMessage": ""}Submit Orders
Once the geolocation check succeeds, the user is legally allowed to submit orders on the platform through your website.
Recommended steps:
- Make sure the user is geolocated successfully from the previous step.
- From the event and market data ingested in step 1, find the specific
strike_idthe user wants to trade. - When the user selects a specific event, market, strike, or side, open a window and ask the user to enter the Prophet Cash amount and price. You can default the price to the best price shown on your platform.
- If
refreshTokenis expired, get a newrefreshTokenusingaccessToken. - Call the submit-order endpoint with
strikeID,price, andquantityin the payload.
Send Tracking Data to ProphetX
To track integration performance effectively, implement the equivalent of this curl command on your side for each order submitted. You can obtain <user_id> from the /me endpoint, and order_ref_id comes from the order submission response.
curl --request POST \
--url https://track.customer.io/api/v1/customers/<user_id>/events \
--header 'content-type: application/json' \
--header 'Authorization:Basic ZWQxMDdkMTYxMDgwN2E0YWQyNTA6ZjBiMzFhNjc1YjkwNTlmMGMwMTc=' \
--data '{"name":"Trade Placed","data":{"order_id":"<order_ref_id>","trade_placement_referred_by":"beeTrader"}}'Updated 9 days ago
