sgmarket api xsf ROLLBOX helper
pip install sgmarkets-api-xsf-rollbox==0.2.0
This repo is meant to make it easy for clients (and employees) to SG XSF Futures Rollbox V1 API.
This repo contains:
From terminal:
# download and install package from pypi.org
pip install sgmarkets_api_xsf_rollbox
# launch notebook
jupyter notebook
Create a notebook or run the demo notebook and modify it to your own use case.
Read the demo notebook.
The key steps are the following.
The package contains the corresponding API swagger url and contact info:
import sgmarkets_api_xsf_rollbox as ROLLBOX
# info about ROLLBOX
ROLLBOX.info()
See the user guide in the sgmarkets-api-auth repo
Select it from the list of those available in the package.
import sgmarkets_api_xsf_rollbox as ROLLBOX
# Examples
ep = ROLLBOX.endpoint.v1_underlyings
ep = ROLLBOX.endpoint.v1_relative_roll
Each end point comes with a Request
object.
# For all endpoints
rq = ep.request()
And fill the object with the necessary data.
This part is specific to the endpoint selected.
See the demo notebook for examples.
Then explore your Request
object to make sure it is properly set.
# For all endpoints
# display the structure of the object
rq.info()
You can call the API directly from the Request
object.
# For all endpoints
# a is an Api object (see 3.2)
res = rq.call_api(a)
The returned object is a Response
object associated to this endpoint.
You can explore it starting with
# For all endpoints
# display the structure of the object
res.info()
As .csv
file.
# For all endpoints
# save to disk
res.save()
The Response
objects are different for each endpoint.
See the demo notebook for examples.
As .html
file.
The resulting html file can be viewed independently from the Jupyter notebook context.
# endpoint ROLLBOX.endpoint.v1_analysis
res.build_dashboard()
See the demo notebook for an example.