# city-trader-python-lib A python library for working with OptionsCity Software’s City Trader REST API.
#### Prerequisites 1. [Python 2.7 or greater](https://www.python.org/downloads/release/python-2710/) 2. [Python setuptools](https://pypi.python.org/pypi/setuptools) 3. A City Trader Username and Password 4. A City Trader API client_id and client_secret
#### Installation 1. [Download the source code](https://github.com/optionshop/city-trader-python-lib/archive/master.zip) 2. Unzip the archive 3. Run: `python setup.py install`
— # Examples ##### Initialize client and retrieve new token `python from citytrader.request_client import RequestClient rc = RequestClient(server="https://devservices.optionshop.com", client_id="<client_id>", client_secret="<client_secret>", username="<username>", password="<password>") `
##### Retrieve all orders `python all_orders = rc.request(request_type="GET", url="orders") `
##### Retrieve single order `python single_order = rc.request(request_type="GET", url="orders/<order_id>") `
##### Retrieve all product groups `python all_productgroups = rc.request(request_type="GET", url="productgroups") `
##### Retrieve all instruments `python all_instruments = rc.request(request_type="GET", url="instruments") `
##### Retrieve market data for a single instrument `python md_message = rc.request(request_type="GET", url="marketdata?instrument_ids=<instrument_id>") `
##### Retrieve market data for multiple instruments `python md_messages = rc.request(request_type="GET", url="marketdata?instrument_ids=<instrument_id_1>&instrument_ids=<instrument_id_2>") `
##### Retrieve market data for just Last and High prices `python md_messages_just_last_and_high = rc.request(request_type="GET", url="marketdata?instrument_ids=<instrument_id_1>&instrument_ids=<instrument_id_2>&sides=Last&sides=High") `
##### Submit a day limit order `python order_results = rc.request(request_type="POST", url="orderactions", data={"acct_id": <account_id>, "action_type": "LimitOrderSub", "instrument_id": <instrument_id>, "limit_price": <limit_price>, "quantity": <quantity>, "side": <side>, "time_in_force": "Day"}) `
Metadata
Release files for CityTraderPythonLib 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| CityTraderPythonLib-0.2-py2.7.egg | Legacy Egg format | - | - | Details for CityTraderPythonLib-0.2-py2.7.egg |
Release files / CityTraderPythonLib-0.2-py2.7.egg
| Download URL | CityTraderPythonLib-0.2-py2.7.egg |
|---|---|
| Size | 8.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
07680a7b47800d3f9d0161fcbdec7c0b3ce97522aae8b5051ad94ff439b2d85e
|
|
BLAKE2b-256 checksum How to use checksums |
cf6c9e5e921ac0b63ce5320d29a4c9e2b55b65fb01b8a75bf2313e9b402643cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for CityTraderPythonLib 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.