sgmarket api xsf COFBOX helper
pip install sgmarkets-api-xsf-cofbox==0.1.0
This repo is meant to make it easy for clients (and employees) to SG XSF Cof Box V1 API.
This repo contains:
From terminal:
# download and install package from pypi.org
pip install sgmarkets_api_xsf_cofbox
# 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_cofbox as COFBOX
# info about COFBOX
COFBOX.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_cofbox as COFBOX
# Examples
ep = COFBOX.endpoint.v1_instruments
ep = COFBOX.endpoint.v1_analysis
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
or .json
file.
# For all endpoints
# save to disk
res.save()
The Response
objects are different for each endpoint.
See the demo notebook for examples.