btgsolutions-otcmarkets-python-client


Namebtgsolutions-otcmarkets-python-client JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/BTG-Pactual-Solutions/btgsolutions-otcmarkets-python-client
SummaryPython library to access BTG OTC Markets APIs.
upload_time2024-09-09 21:03:00
maintainerNone
docs_urlNone
authorBTG Solutions
requires_python>=3.7.1
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BTG Solutions - OTC Markets

Python library to access BTG OTC Markets.

Official package docs are hosted at https://otcmarkets-python-docs.btgpactualsolutions.com/

## Installation

```bash
pip3 install btgsolutions-otcmarkets-python-client
```

## Examples

### Ticker Reference Data

```python
import btgsolutions_otcmarkets as otc
ref = otc.ReferenceData(api_key='API_KEY')
ref.get_ticker_data(tickers=['ZTEST01', 'ZTEST02'])
```

### Ticker Reference Data (All Tickers)

```python
import btgsolutions_otcmarkets as otc
ref = otc.ReferenceData(api_key='API_KEY')
ref.get_ticker_data()
```

### Ticker Pricing

```python
import btgsolutions_otcmarkets as otc
pricing = otc.Pricing(api_key='API_KEY')
pricing.get_ticker_price(ticker='ZTEST01', rate=6.51)
# pricing.get_ticker_rate(ticker='ZTEST01', price=1052.20)
```

### Top Of Book

```python
import btgsolutions_otcmarkets as otc
tob = otc.TopOfBook(api_key='API_KEY')
tob.get_top_of_book(ticker='ZTEST01')
```

### Top Of Book (All Tickers)

```python
import btgsolutions_otcmarkets as otc
tob = otc.TopOfBook(api_key='API_KEY')
tob.get_top_of_book()
```

### Risk Status

```python
import btgsolutions_otcmarkets as otc
risk = otc.Risk(api_key='API_KEY')
risk.risk_status_trader(investor_id='YOUR_INVESTOR_ID')
# risk.risk_status_investor(investor_id='YOUR_INVESTOR_ID')
```

### Market Data Stream

```python
import btgsolutions_otcmarkets as otc
mktdata = otc.MarketDataStream(api_key='API_KEY')
mktdata.run()
mktdata.subscribe(tickers=['ZTEST01'])
# mktdata.unsubscribe(tickers=['ZTEST01'])

## The following code is optional, it keeps the program running in a .py file:
# from time import sleep
# while True:
#   sleep(1)
```

### Order Entry - Create New Order

```python
import btgsolutions_otcmarkets as otc
order_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')
order_entry.run()
order_entry.create_new_order(
    order_temp_id="123",
    ticker='ZTEST01',
    rate=6.22,
    qty=200,
    side='buy',
)

## The following code is optional, it keeps the program running in a .py file:
# from time import sleep
# while True:
#   sleep(1)
```

### Order Entry - Replace Order

```python
import btgsolutions_otcmarkets as otc
order_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')
order_entry.run()
order_entry.replace_order(
    external_id="your-order-external-id",
    rate=6.30,
    qty=180,
)

## The following code is optional, it keeps the program running in a .py file:
# from time import sleep
# while True:
#   sleep(1)
```

### Order Entry - Cancel Order

```python
import btgsolutions_otcmarkets as otc
order_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')
order_entry.run()
order_entry.cancel_order(
    external_id="your-order-external-id",
)

## The following code is optional, it keeps the program running in a .py file:
# from time import sleep
# while True:
#   sleep(1)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/BTG-Pactual-Solutions/btgsolutions-otcmarkets-python-client",
    "name": "btgsolutions-otcmarkets-python-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "BTG Solutions",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0a/c1/d5f4d17a8d23b3a3f4f1f304596be42f39f55847a211b1c3c4bf531b47f3/btgsolutions-otcmarkets-python-client-0.0.4.tar.gz",
    "platform": null,
    "description": "# BTG Solutions - OTC Markets\n\nPython library to access BTG OTC Markets.\n\nOfficial package docs are hosted at https://otcmarkets-python-docs.btgpactualsolutions.com/\n\n## Installation\n\n```bash\npip3 install btgsolutions-otcmarkets-python-client\n```\n\n## Examples\n\n### Ticker Reference Data\n\n```python\nimport btgsolutions_otcmarkets as otc\nref = otc.ReferenceData(api_key='API_KEY')\nref.get_ticker_data(tickers=['ZTEST01', 'ZTEST02'])\n```\n\n### Ticker Reference Data (All Tickers)\n\n```python\nimport btgsolutions_otcmarkets as otc\nref = otc.ReferenceData(api_key='API_KEY')\nref.get_ticker_data()\n```\n\n### Ticker Pricing\n\n```python\nimport btgsolutions_otcmarkets as otc\npricing = otc.Pricing(api_key='API_KEY')\npricing.get_ticker_price(ticker='ZTEST01', rate=6.51)\n# pricing.get_ticker_rate(ticker='ZTEST01', price=1052.20)\n```\n\n### Top Of Book\n\n```python\nimport btgsolutions_otcmarkets as otc\ntob = otc.TopOfBook(api_key='API_KEY')\ntob.get_top_of_book(ticker='ZTEST01')\n```\n\n### Top Of Book (All Tickers)\n\n```python\nimport btgsolutions_otcmarkets as otc\ntob = otc.TopOfBook(api_key='API_KEY')\ntob.get_top_of_book()\n```\n\n### Risk Status\n\n```python\nimport btgsolutions_otcmarkets as otc\nrisk = otc.Risk(api_key='API_KEY')\nrisk.risk_status_trader(investor_id='YOUR_INVESTOR_ID')\n# risk.risk_status_investor(investor_id='YOUR_INVESTOR_ID')\n```\n\n### Market Data Stream\n\n```python\nimport btgsolutions_otcmarkets as otc\nmktdata = otc.MarketDataStream(api_key='API_KEY')\nmktdata.run()\nmktdata.subscribe(tickers=['ZTEST01'])\n# mktdata.unsubscribe(tickers=['ZTEST01'])\n\n## The following code is optional, it keeps the program running in a .py file:\n# from time import sleep\n# while True:\n#   sleep(1)\n```\n\n### Order Entry - Create New Order\n\n```python\nimport btgsolutions_otcmarkets as otc\norder_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')\norder_entry.run()\norder_entry.create_new_order(\n    order_temp_id=\"123\",\n    ticker='ZTEST01',\n    rate=6.22,\n    qty=200,\n    side='buy',\n)\n\n## The following code is optional, it keeps the program running in a .py file:\n# from time import sleep\n# while True:\n#   sleep(1)\n```\n\n### Order Entry - Replace Order\n\n```python\nimport btgsolutions_otcmarkets as otc\norder_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')\norder_entry.run()\norder_entry.replace_order(\n    external_id=\"your-order-external-id\",\n    rate=6.30,\n    qty=180,\n)\n\n## The following code is optional, it keeps the program running in a .py file:\n# from time import sleep\n# while True:\n#   sleep(1)\n```\n\n### Order Entry - Cancel Order\n\n```python\nimport btgsolutions_otcmarkets as otc\norder_entry = otc.OrderEntry(api_key='API_KEY', investor_id='YOUR_INVESTOR_ID')\norder_entry.run()\norder_entry.cancel_order(\n    external_id=\"your-order-external-id\",\n)\n\n## The following code is optional, it keeps the program running in a .py file:\n# from time import sleep\n# while True:\n#   sleep(1)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library to access BTG OTC Markets APIs.",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/BTG-Pactual-Solutions/btgsolutions-otcmarkets-python-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ac1d5f4d17a8d23b3a3f4f1f304596be42f39f55847a211b1c3c4bf531b47f3",
                "md5": "1f3037a0df49cda58f7787eb17732ef2",
                "sha256": "4cff9808975c84c5983ab6982ffcde26bb09860a29200eae7c605c0bcb0f32d3"
            },
            "downloads": -1,
            "filename": "btgsolutions-otcmarkets-python-client-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "1f3037a0df49cda58f7787eb17732ef2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.1",
            "size": 10042,
            "upload_time": "2024-09-09T21:03:00",
            "upload_time_iso_8601": "2024-09-09T21:03:00.490612Z",
            "url": "https://files.pythonhosted.org/packages/0a/c1/d5f4d17a8d23b3a3f4f1f304596be42f39f55847a211b1c3c4bf531b47f3/btgsolutions-otcmarkets-python-client-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 21:03:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BTG-Pactual-Solutions",
    "github_project": "btgsolutions-otcmarkets-python-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "btgsolutions-otcmarkets-python-client"
}
        
Elapsed time: 0.79918s