Pure python financial securities dataclasses, as foundation for other projects
Project description
financial-security-classes
Pure python financial securities dataclasses, as foundation for other projects
Examples
First set up and import the library
import datetime
import finsec as fs
Create a currency
usd = fs.FiatCurrency(
ticker = 'USD',
nation = 'United States Dollar',
gsid = fs.GSID(20),
identifiers = [
fs.ISIN('abcdefg'),
],
)
Create an index, denominated in USD
spx = fs.DerivedIndex(
ticker = 'SPX',
issuer = 'Standard & Poor',
gsid = fs.GSID(100),
identifiers = [
fs.FIGI('12345'),
],
currency = usd,
)
Create a few stocks
hyg = fs.ETP(
ticker = 'HYG',
gsid = fs.GSID(124),
description = 'ISHARES IBOXX HIGH YLD CORP',
primary_exc = fs.Exchange.NYSE,
issuer = 'ishares',
)
tsla = fs.Stock(
## Ticker will be auto-capitalized
ticker = 'tSla',
gsid = fs.GSID(125),
description = 'Tesla corp',
primary_exc = fs.Exchange.NYSE,
)
Create a future, with SPX as underlier
esu22 = fs.NewFuture(
gsid = fs.GSID(120),
ticker = 'ESU22',
underlying_security = spx,
expiry_date = datetime.date(2022,9,16),
primary_exc = fs.Exchange.CME,
expiry_time_of_day = fs.ExpiryTimeOfDay.OPEN,
tick_size = 0.25,
multiplier = 50.0,
identifiers = [
fs.FIGI('234567'),
],
#### This should be implied, since underlyer doesn't permit physical delivery
# settlement_type = fs.SettlementType.CASH,
#### Without this argument, this should be set to UNKNOWN
# expiry_series_type = fs.ExpirySeriesType.MONTHLY,
)
To run tests:
$ python3.9 -m virtualenv venv
$ venv/bin/activate
$ make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for financial-security-classes-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d8f1d1c919e32fa93ad5efe76fae0e448094e189881c67184b69cda8271b6d |
|
MD5 | afa2bc31b307dd2d75a9cb42c6421771 |
|
BLAKE2b-256 | e3c247c55de6cfa9d9c24c9c0e0b856438fb03ad7229e923eef08670ccd36059 |
Close
Hashes for financial_security_classes-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d9efbae138ea25856b60a3d0509c7adb7297e65b9baa415511d1de8b688c0d1 |
|
MD5 | a4dde68af56dfbbd2c3d185bc4799160 |
|
BLAKE2b-256 | f5cbcd0422887838f9a4eae672e3c0b380e321eb761d5c662c9c132ccf180a0b |