Skip to content

Latest commit

 

History

History
343 lines (304 loc) · 27.4 KB

File metadata and controls

343 lines (304 loc) · 27.4 KB

ibkr-web-api

Client Poral Web API

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Generator version: 7.13.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.9+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import ibkr_web_api

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import ibkr_web_api

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import ibkr_web_api
from ibkr_web_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:5000/v1/api
# See configuration.py for a list of all supported configuration parameters.
configuration = ibkr_web_api.Configuration(
    host = "http://localhost:5000/v1/api"
)



# Enter a context with an instance of the API client
with ibkr_web_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ibkr_web_api.AccountApi(api_client)

    try:
        # PnL for the selected account
        api_response = api_instance.iserver_account_pnl_partitioned_get()
        print("The response of AccountApi->iserver_account_pnl_partitioned_get:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AccountApi->iserver_account_pnl_partitioned_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:5000/v1/api

Class Method HTTP request Description
AccountApi iserver_account_pnl_partitioned_get GET /iserver/account/pnl/partitioned PnL for the selected account
AccountApi iserver_account_post POST /iserver/account Switch Account
AccountApi iserver_accounts_get GET /iserver/accounts Brokerage Accounts
AccountApi portfolio_account_id_ledger_get GET /portfolio/{accountId}/ledger Account Ledger
AccountApi portfolio_account_id_meta_get GET /portfolio/{accountId}/meta Account Information
AccountApi portfolio_account_id_summary_get GET /portfolio/{accountId}/summary Account Summary
AccountApi portfolio_accounts_get GET /portfolio/accounts Portfolio Accounts
AccountApi portfolio_subaccounts2_get GET /portfolio/subaccounts2 List of Sub-Accounts (Large Accounts)
AccountApi portfolio_subaccounts_get GET /portfolio/subaccounts List of Sub-Accounts
AlertApi iserver_account_account_id_alert_activate_post POST /iserver/account/:accountId/alert/activate Activate or deactivate an alert
AlertApi iserver_account_account_id_alert_alert_id_delete DELETE /iserver/account/:accountId/alert/:alertId Delete an alert
AlertApi iserver_account_account_id_alert_post POST /iserver/account/{accountId}/alert Create or modify alert
AlertApi iserver_account_account_id_alerts_get GET /iserver/account/:accountId/alerts Get a list of available alerts
AlertApi iserver_account_alert_id_get GET /iserver/account/alert/:id Get details of an alert
AlertApi iserver_account_mta_get GET /iserver/account/mta Get MTA alert
CCPBetaApi ccp_account_get GET /ccp/account Brokerage Accounts
CCPBetaApi ccp_auth_init_post POST /ccp/auth/init Start CCP Session
CCPBetaApi ccp_auth_response_post POST /ccp/auth/response Complete CCP Session
CCPBetaApi ccp_order_delete DELETE /ccp/order Delete Order
CCPBetaApi ccp_order_post POST /ccp/order Submit Order
CCPBetaApi ccp_order_put PUT /ccp/order Update Order
CCPBetaApi ccp_orders_get GET /ccp/orders Order Status
CCPBetaApi ccp_positions_get GET /ccp/positions Positions
CCPBetaApi ccp_status_get GET /ccp/status CCP Status
CCPBetaApi ccp_trades_get GET /ccp/trades Trades
ContractApi iserver_contract_conid_algos_get GET /iserver/contract/{conid}/algos IB Algo Params
ContractApi iserver_contract_conid_info_and_rules_get GET /iserver/contract/{conid}/info-and-rules Info and Rules
ContractApi iserver_contract_conid_info_get GET /iserver/contract/{conid}/info Contract Details
ContractApi iserver_contract_rules_post POST /iserver/contract/rules Contract Rules
ContractApi iserver_secdef_info_get GET /iserver/secdef/info Secdef Info
ContractApi iserver_secdef_search_post POST /iserver/secdef/search Search by Symbol or Name
ContractApi iserver_secdef_strikes_get GET /iserver/secdef/strikes Search Strikes
ContractApi trsrv_futures_get GET /trsrv/futures Security Futures by Symbol
ContractApi trsrv_secdef_post POST /trsrv/secdef Secdef by Conid
ContractApi trsrv_secdef_schedule_get GET /trsrv/secdef/schedule Get trading schedule for symbol
ContractApi trsrv_stocks_get GET /trsrv/stocks Security Stocks by Symbol
FYIApi fyi_deliveryoptions_device_id_delete DELETE /fyi/deliveryoptions/{deviceId} Delete a device
FYIApi fyi_deliveryoptions_device_post POST /fyi/deliveryoptions/device Enable/Disable device option
FYIApi fyi_deliveryoptions_email_put PUT /fyi/deliveryoptions/email Enable/Disable email option
FYIApi fyi_deliveryoptions_get GET /fyi/deliveryoptions Get delivery options
FYIApi fyi_disclaimer_typecode_get GET /fyi/disclaimer/{typecode} Get disclaimer for a certain kind of fyi
FYIApi fyi_disclaimer_typecode_put PUT /fyi/disclaimer/{typecode} Mark disclaimer read
FYIApi fyi_notifications_get GET /fyi/notifications Get a list of notifications
FYIApi fyi_notifications_more_get GET /fyi/notifications/more Get more notifications based on a certain one
FYIApi fyi_notifications_notification_id_put PUT /fyi/notifications/{notificationId} Get a list of notifications
FYIApi fyi_settings_get GET /fyi/settings Get a list of subscriptions
FYIApi fyi_settings_typecode_post POST /fyi/settings/{typecode} Enable/Disable certain subscription
FYIApi fyi_unreadnumber_get GET /fyi/unreadnumber Get unread number of fyis. The HTTP method POST is also supported.
MarketDataApi hmds_history_get GET /hmds/history Market Data History (Beta)
MarketDataApi iserver_marketdata_conid_unsubscribe_get GET /iserver/marketdata/{conid}/unsubscribe Market Data Cancel (Single)
MarketDataApi iserver_marketdata_history_get GET /iserver/marketdata/history Market Data History
MarketDataApi iserver_marketdata_snapshot_get GET /iserver/marketdata/snapshot Market Data
MarketDataApi iserver_marketdata_unsubscribeall_get GET /iserver/marketdata/unsubscribeall Market Data Cancel (All)
MarketDataApi md_snapshot_get GET /md/snapshot Market Data Snapshot (Beta)
OrderApi iserver_account_account_id_order_order_id_delete DELETE /iserver/account/{accountId}/order/{orderId} Cancel Order
OrderApi iserver_account_account_id_order_order_id_post POST /iserver/account/{accountId}/order/{orderId} Modify Order
OrderApi iserver_account_account_id_order_post POST /iserver/account/{accountId}/order Place Order (Deprecated)
OrderApi iserver_account_account_id_order_whatif_post POST /iserver/account/{accountId}/order/whatif Preview Order (Deprecated)
OrderApi iserver_account_account_id_orders_post POST /iserver/account/{accountId}/orders Place Orders
OrderApi iserver_account_account_id_orders_whatif_post POST /iserver/account/{accountId}/orders/whatif Preview Orders
OrderApi iserver_account_order_status_order_id_get GET /iserver/account/order/status/{orderId} Order Status
OrderApi iserver_account_orders_fa_group_post POST /iserver/account/orders/{faGroup} Place Orders for FA
OrderApi iserver_account_orders_get GET /iserver/account/orders Live Orders
OrderApi iserver_reply_replyid_post POST /iserver/reply/{replyid} Place Order Reply
PnLApi iserver_account_pnl_partitioned_get GET /iserver/account/pnl/partitioned PnL for the selected account
PortfolioApi portfolio_account_id_allocation_get GET /portfolio/{accountId}/allocation Account Allocation
PortfolioApi portfolio_account_id_ledger_get GET /portfolio/{accountId}/ledger Account Ledger
PortfolioApi portfolio_account_id_meta_get GET /portfolio/{accountId}/meta Account Information
PortfolioApi portfolio_account_id_position_conid_get GET /portfolio/{accountId}/position/{conid} Position by Conid
PortfolioApi portfolio_account_id_positions_invalidate_post POST /portfolio/{accountId}/positions/invalidate Invalidates the backend cache of the Portfolio
PortfolioApi portfolio_account_id_positions_page_id_get GET /portfolio/{accountId}/positions/{pageId} Portfolio Positions
PortfolioApi portfolio_account_id_summary_get GET /portfolio/{accountId}/summary Account Summary
PortfolioApi portfolio_accounts_get GET /portfolio/accounts Portfolio Accounts
PortfolioApi portfolio_allocation_post POST /portfolio/allocation Account Alloction (All Accounts)
PortfolioApi portfolio_positions_conid_get GET /portfolio/positions/{conid} Positions by Conid
PortfolioApi portfolio_subaccounts2_get GET /portfolio/subaccounts2 List of Sub-Accounts (Large Accounts)
PortfolioApi portfolio_subaccounts_get GET /portfolio/subaccounts List of Sub-Accounts
PortfolioAnalystApi pa_performance_post POST /pa/performance Account Performance
PortfolioAnalystApi pa_summary_post POST /pa/summary Account Balance's Summary (Deprecated)
PortfolioAnalystApi pa_transactions_post POST /pa/transactions Position's Transaction History
ScannerApi hmds_scanner_post POST /hmds/scanner Run Scanner (Beta)
ScannerApi iserver_scanner_params_get GET /iserver/scanner/params Scanner Parameters
ScannerApi iserver_scanner_run_post POST /iserver/scanner/run Scanner Run
SessionApi iserver_auth_status_post POST /iserver/auth/status Authentication Status
SessionApi iserver_reauthenticate_post POST /iserver/reauthenticate Tries to re-authenticate to Brokerage
SessionApi logout_post POST /logout Ends the current session
SessionApi sso_validate_get GET /sso/validate Validate SSO
SessionApi tickle_post POST /tickle Ping the server to keep the session open
StreamingApi ws_post POST /ws Websocket Endpoint
TradesApi iserver_account_trades_get GET /iserver/account/trades List of Trades for the selected account

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Author