Asklora Portal
Shared utilities and helper classes used in Asklora projects
Contents
- Clients for external services (MarketData, Broker, PriceData, DAMECAClient, DAMFBClient) and their supporting classes (DAM, pydantic models for xml serialising and de-serialising)
- Helper classes (SingletonMeta, ExtendedEnum, PGPHelper)
- Helper functions (deep_get, get_file_size, get_file_sha1)
Information on specific sections
Broker, PriceData and MarketData client
required .env config when importing these
BROKER_API_URL=brokerurlMARKET_API_URL=market urlBROKER_KEY=keyBROKER_SECRET=secret
usage
from asklora import Broker
broker = Broker()
broker.create_account(...)
or you can use our Portal class to get the specific model
import asklora
portal = asklora.Portal()
rest = portal.get_broker_client() # get a REST client for trade, user, position , order
marketrest = portal.get_market_client() # get a REST client for market data
eventclient = portal.get_event_client() # get an event client for trade, user, position, order
PriceData (for IEX)
required .env config
IEX_API_URLIEX_TOKEN
usage
from asklora import PriceData
price_data = PriceData()
price_data.get_lastestPrice("MSFT")
DAMECAClient and DAMFBClient
required .env config
DAM_URLDAM_CSID
usage
For these clients, you can find the Pydantic models needed by some of the class methods in the models and enums module.
for example, in the DAMECAClient, in the generate_application_payload method, the first argument accepts DAMApplicationPayload model that will automatically processed to xml the API endpoint needs.
examples
-
DAMECAClient
from asklora import DAMECAClient, PGPHelper from asklora.models import DAMApplicationPayload client = DAMECAClient() # Build payload payload = DAMApplicationPayload( user_id=56, first_name="Jane", last_name="Smith", ... ) # Needed for encryption pgp_helper = PGPHelper( private_key_path=..., public_key_path=..., remote_public_key_path=..., ) # Send the request client.create_account(payload, pgp_helper=pgp_helper)
-
DAMFBClient
from asklora import DAMFBClient, PGPHelper from asklora.models import InstructionSet, InternalCashTransfer, CancelTransaction client = DAMFBClient() instruction_set = InstructionSet( instructions=[ InternalCashTransfer( id=4, source="U199516", destination="U34516", amount=1000, currency="USD", ), CancelTransaction( id=5, ib_instr_id="3", reason="Wrong destination", ), ] ) pgp_helper = PGPHelper( private_key_path=..., public_key_path=..., remote_public_key_path=..., ) client.create_instruction(instruction_set, pgp_helper=pgp_helper) # if needed, you can also send xml directly payload = """<?xml version="1.0" encoding="UTF-8"?> <instruction_set xmlns="http://www.interactivebrokers.com/fbfb_instruction_set" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.interactivebrokers.com/fbfb_instruction_set fbfb_instruction_set.xsd " creation_date="2019-01-11" id="2450" version="1"> <close_account id="2450"> <client_ib_acct_id>U1234567</client_ib_acct_id> <close_reason> No longer needed </close_reason> </close_account> </instruction_set>""" client.create_instruction(payload, pgp_helper=pgp_helper)
-
Both
You can also initialise one or both of the classes above like this:
from asklora import IBClient eca_client = IBClient.get_ECA_client() fb_client = IBClient.get_FB_client()
Metadata
Release files for asklora-portal 1.1.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asklora_portal-1.1.13.tar.gz | 28.2 kB | Without provenance | Details for asklora_portal-1.1.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asklora_portal-1.1.13-py3-none-any.whl | Python 3 | none | any | Details for asklora_portal-1.1.13-py3-none-any.whl |
Total release size: 62.5 kB
Release files / asklora_portal-1.1.13.tar.gz
| Download URL | asklora_portal-1.1.13.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25b07072bc9c5df46615a4fbde7ca11954e753129bdb70a44f09f4a1941a38fb
|
|
BLAKE2b-256 checksum How to use checksums |
5205a18719e8499289b490df476e4c7240fd8d5f6e337a66ea5ba724318bad89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/6.4.6-76060406-generic
|
Release files / asklora_portal-1.1.13-py3-none-any.whl
| Download URL | asklora_portal-1.1.13-py3-none-any.whl |
|---|---|
| Size | 34.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e60c44675d5bd4fe987546c8b449f01e84277e33f328e2b506bf89b2ba61a5dd
|
|
BLAKE2b-256 checksum How to use checksums |
d84c4a5d06f58fd20c3b6a7b3a97b4025ad2e2b4dfd6349264b47d7da50cf97a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.4 Linux/6.4.6-76060406-generic
|
Security for asklora-portal 1.1.13
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.