BrokerQL


NameBrokerQL JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://brokerql.github.io
SummaryUse SQL to instantly query your online brokers (IBKR and more).
upload_time2024-01-26 02:03:05
maintainer
docs_urlNone
authorPan Jiabang
requires_python>=3.9
licenseAGPL v3
keywords mysql sql tws brokers trading
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [<picture><source media="(prefers-color-scheme: dark)" srcset="https://brokerql.github.io/images/logo/logo-auto-color.svg"><source media="(prefers-color-scheme: light)" srcset="https://brokerql.github.io/images/logo/logo-auto-color.svg"><img width="67%" alt="BrokerQL Logo" src="https://brokerql.github.io/images/logo/logo-auto-color.svg"></picture>](https://brokerql.github.io?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme)

BrokerQL is the database interface to Brokers and Finance Market. Use SQL to query quotes, positions, query or place orders, and find investing or trading ideas.

BrokerQL is built with ❤ by trader, and built for traders, portfolio managers, and financial advisors who knows a little about SQL, to decrease daily job of portfolio management.

BrokerQL is inspired by [Steampipe](https://steampipe.io/).

With [BrokerQL](https://brokerql.github.io?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme) you can:

- **Query** → Use SQL to query (and join across!) from your Brokers.

- **Modify** → Update multiple order's price and quantity with SQL.  


## BrokerQL CLI: The SQL console for Online Brokers.

The BrokerQL community has grown a suite of plugins that map Brokers to tables.

<table>
  <tr>
   <td><b>US Brokers</b></td>
   <td><a href="https://www.interactivebrokers.com/">IBKR</a> …</td>
  </tr>
</table>



The interactive query shell is one way you can query those tables.

<img width="524" src="https://brokerql.github.io/assets/demo.gif" />

You can also use mysql-client, mycli, DataGrip, or any client that can connect to MySQL.

### Get started with the CLI

<details>

 <summary>Install BrokerQL</summary>
 <br/>

The <a href="https://brokerql.github.io/download?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme">download</a> page shows you how but tl;dr:

Linux or Windows or macOS

```sh
pip install BrokerQL
```

macOS only

```sh
brew tap BrokerQL/tap
brew install broker-ql
```

</details>


 <details>
 <summary>Run <tt>BrokerQL query</tt></summary>
<br/>

Make sure your IBKR TWS is running on localhost, and listen to port 7496 for API.

<img width="524" src="https://brokerql.github.io/images/doc/tws_api_config.png" />

Launch the interactive shell.

```sh
broker-ql --cli
```

Run your first query!

```sql
select * from tws.positions;
```
</details>

<details>
 <summary>Learn more about the CLI</summary>

- It's just SQL

- You can run queries on the command line and include them in scripts.

 </details>

 <details>
 <summary>Build and develop the CLI</summary>

Prerequisites:

- Python Version 3.9.

Clone:

```sh
git clone git@github.com:BrokerQL/BrokerQL
cd BrokerQL
```

Create virtualenv, and run the pip command

```
python -m venv venv
source venv/bin/activate
pip install .
pip install -r requirements-dev.txt
```

Check the version

```
$ broker-ql -v
BrokerQL v0.0.1
```

Try it!

```
broker-ql --cli
connecting to tws...
tws connected
BrokerQL (none)> nopager
Pager disabled.
Time: 0.000s
BrokerQL (none)> show databases
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| tws                |
+--------------------+
3 rows in set
Time: 0.036s
BrokerQL (none)> use tws
You are now connected to database "tws" as user "panjiabang"
Time: 0.001s
BrokerQL tws> show tables
+---------------+
| Table_name    |
+---------------+
| orders        |
| positions     |
| quotes        |
| subscriptions |
+---------------+
4 rows in set
Time: 0.033s
BrokerQL tws> select * from positions
+-----------+--------+----------+--------------------+
| account   | symbol | position | avg_cost           |
+-----------+--------+----------+--------------------+
| U11739578 | ADBE   |  6.0     | 579.3533333333334  |
| U11739578 | PDD    | 32.0     | 119.65125          |
| U11739578 | URNM   | 62.0     |  49.18850806451613 |
| U11739578 | QQQ    | 27.0     | 385.82703703703703 |
| U11739578 | MSFT   | 12.0     | 378.9533333333333  |
| U11739578 | MHO    | 40.0     | 103.19500000000001 |
+-----------+--------+----------+--------------------+
12 rows in set
Time: 0.037s
```
</details>

## Community

We thrive on feedback and community involvement!

**Have a question?** →  Join our [Github Discussions](https://github.com/BrokerQL/BrokerQL/discussions) or open a [GitHub issue](https://github.com/BrokerQL/BrokerQL/issues/new/choose).

            

Raw data

            {
    "_id": null,
    "home_page": "https://brokerql.github.io",
    "name": "BrokerQL",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "mysql sql tws brokers trading",
    "author": "Pan Jiabang",
    "author_email": "panjiabang@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ac/8c/4c8403d0a8e2f86fa02503a85a614d121f38afd2ae0abce2b3b4c3ad94ae/BrokerQL-0.0.2.tar.gz",
    "platform": null,
    "description": "[<picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://brokerql.github.io/images/logo/logo-auto-color.svg\"><source media=\"(prefers-color-scheme: light)\" srcset=\"https://brokerql.github.io/images/logo/logo-auto-color.svg\"><img width=\"67%\" alt=\"BrokerQL Logo\" src=\"https://brokerql.github.io/images/logo/logo-auto-color.svg\"></picture>](https://brokerql.github.io?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme)\n\nBrokerQL is the database interface to Brokers and Finance Market. Use SQL to query quotes, positions, query or place orders, and find investing or trading ideas.\n\nBrokerQL is built with \u2764 by trader, and built for traders, portfolio managers, and financial advisors who knows a little about SQL, to decrease daily job of portfolio management.\n\nBrokerQL is inspired by [Steampipe](https://steampipe.io/).\n\nWith [BrokerQL](https://brokerql.github.io?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme) you can:\n\n- **Query** \u2192 Use SQL to query (and join across!) from your Brokers.\n\n- **Modify** \u2192 Update multiple order's price and quantity with SQL.  \n\n\n## BrokerQL CLI: The SQL console for Online Brokers.\n\nThe BrokerQL community has grown a suite of plugins that map Brokers to tables.\n\n<table>\n  <tr>\n   <td><b>US Brokers</b></td>\n   <td><a href=\"https://www.interactivebrokers.com/\">IBKR</a> \u2026</td>\n  </tr>\n</table>\n\n\n\nThe interactive query shell is one way you can query those tables.\n\n<img width=\"524\" src=\"https://brokerql.github.io/assets/demo.gif\" />\n\nYou can also use mysql-client, mycli, DataGrip, or any client that can connect to MySQL.\n\n### Get started with the CLI\n\n<details>\n\n <summary>Install BrokerQL</summary>\n <br/>\n\nThe <a href=\"https://brokerql.github.io/download?utm_id=gspreadme&utm_source=github&utm_medium=repo&utm_campaign=github&utm_content=readme\">download</a> page shows you how but tl;dr:\n\nLinux or Windows or macOS\n\n```sh\npip install BrokerQL\n```\n\nmacOS only\n\n```sh\nbrew tap BrokerQL/tap\nbrew install broker-ql\n```\n\n</details>\n\n\n <details>\n <summary>Run <tt>BrokerQL query</tt></summary>\n<br/>\n\nMake sure your IBKR TWS is running on localhost, and listen to port 7496 for API.\n\n<img width=\"524\" src=\"https://brokerql.github.io/images/doc/tws_api_config.png\" />\n\nLaunch the interactive shell.\n\n```sh\nbroker-ql --cli\n```\n\nRun your first query!\n\n```sql\nselect * from tws.positions;\n```\n</details>\n\n<details>\n <summary>Learn more about the CLI</summary>\n\n- It's just SQL\n\n- You can run queries on the command line and include them in scripts.\n\n </details>\n\n <details>\n <summary>Build and develop the CLI</summary>\n\nPrerequisites:\n\n- Python Version 3.9.\n\nClone:\n\n```sh\ngit clone git@github.com:BrokerQL/BrokerQL\ncd BrokerQL\n```\n\nCreate virtualenv, and run the pip command\n\n```\npython -m venv venv\nsource venv/bin/activate\npip install .\npip install -r requirements-dev.txt\n```\n\nCheck the version\n\n```\n$ broker-ql -v\nBrokerQL v0.0.1\n```\n\nTry it!\n\n```\nbroker-ql --cli\nconnecting to tws...\ntws connected\nBrokerQL (none)> nopager\nPager disabled.\nTime: 0.000s\nBrokerQL (none)> show databases\n+--------------------+\n| Database           |\n+--------------------+\n| information_schema |\n| mysql              |\n| tws                |\n+--------------------+\n3 rows in set\nTime: 0.036s\nBrokerQL (none)> use tws\nYou are now connected to database \"tws\" as user \"panjiabang\"\nTime: 0.001s\nBrokerQL tws> show tables\n+---------------+\n| Table_name    |\n+---------------+\n| orders        |\n| positions     |\n| quotes        |\n| subscriptions |\n+---------------+\n4 rows in set\nTime: 0.033s\nBrokerQL tws> select * from positions\n+-----------+--------+----------+--------------------+\n| account   | symbol | position | avg_cost           |\n+-----------+--------+----------+--------------------+\n| U11739578 | ADBE   |  6.0     | 579.3533333333334  |\n| U11739578 | PDD    | 32.0     | 119.65125          |\n| U11739578 | URNM   | 62.0     |  49.18850806451613 |\n| U11739578 | QQQ    | 27.0     | 385.82703703703703 |\n| U11739578 | MSFT   | 12.0     | 378.9533333333333  |\n| U11739578 | MHO    | 40.0     | 103.19500000000001 |\n+-----------+--------+----------+--------------------+\n12 rows in set\nTime: 0.037s\n```\n</details>\n\n## Community\n\nWe thrive on feedback and community involvement!\n\n**Have a question?** \u2192  Join our [Github Discussions](https://github.com/BrokerQL/BrokerQL/discussions) or open a [GitHub issue](https://github.com/BrokerQL/BrokerQL/issues/new/choose).\n",
    "bugtrack_url": null,
    "license": "AGPL v3",
    "summary": "Use SQL to instantly query your online brokers (IBKR and more).",
    "version": "0.0.2",
    "project_urls": {
        "Documentation": "https://brokerql.github.io",
        "Homepage": "https://brokerql.github.io",
        "Source": "https://github.com/BrokerQL/BrokerQL",
        "Twitter": "https://twitter.com/BrokerQL"
    },
    "split_keywords": [
        "mysql",
        "sql",
        "tws",
        "brokers",
        "trading"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a0f59e79fd01df54479d9877201095a17b3c4106a251b232d80e6ef01fa98e3",
                "md5": "03c7a081175b6122064b09ca801fffd7",
                "sha256": "00c86f021202186244f7fcd3a43b6b6c46d65f29a439e6b38b85e6212321c929"
            },
            "downloads": -1,
            "filename": "BrokerQL-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03c7a081175b6122064b09ca801fffd7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 34476,
            "upload_time": "2024-01-26T02:03:03",
            "upload_time_iso_8601": "2024-01-26T02:03:03.149071Z",
            "url": "https://files.pythonhosted.org/packages/0a/0f/59e79fd01df54479d9877201095a17b3c4106a251b232d80e6ef01fa98e3/BrokerQL-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac8c4c8403d0a8e2f86fa02503a85a614d121f38afd2ae0abce2b3b4c3ad94ae",
                "md5": "6e5ca82d31a73d393879176cc53c3701",
                "sha256": "147a61207d94f53fcbacbd128f50e18b9c8898b17fdc53bcad99ae80080f0749"
            },
            "downloads": -1,
            "filename": "BrokerQL-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "6e5ca82d31a73d393879176cc53c3701",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 32028,
            "upload_time": "2024-01-26T02:03:05",
            "upload_time_iso_8601": "2024-01-26T02:03:05.060529Z",
            "url": "https://files.pythonhosted.org/packages/ac/8c/4c8403d0a8e2f86fa02503a85a614d121f38afd2ae0abce2b3b4c3ad94ae/BrokerQL-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-26 02:03:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BrokerQL",
    "github_project": "BrokerQL",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "brokerql"
}
        
Elapsed time: 0.17139s