A set of basic objects for storing and querying stock market company and sectors
Project description
stockobjects
A simple set of objects for representing stock and sector objects in Python.
Learning intention
- Packaging my own reusable modules
- Working towards mastery of OO in Python - more advance scoping, testing, inversion of control, dunder methods
- More advanced testing approaches
todo
- More testing
- Use mocking
- Additional validation for dates and checking that exceptions are raised in all edge cases
- Moving from dict to custom objects for quote collections so that I can use built-in methods via dunders and type hinting for how to interact (dicts provide no hints)
Usage
Data structure
SectorCollection object contains 0:m Sector objects Sector object contains 0:m SectorQuote objects Sector object contains 0:m Company objects Company object contains 0:m CompanyQuote objects
Examples
Instantiate the SectorCollection. A better name (todo!) would be Market instead of SectorCollection
my_collection = SectorCollection(name="My first collection")
Instantiate a sector to add to the SectorCollection
my_sector = Sector(sector_name="Fruit sector", sector_code="xbf")
my_collection.add_sector(my_sector)
Instantiate a company and add it to the sector
my_company = Company(company_name="Banana company", company_code="ban", sector_object=my_sector)
my_collection.get_sector(my_sector.sector_code).add_company(my_company)
From here, instantiate SectorQuotes and Company quotes And then start querying them
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
File details
Details for the file ctf-stockobjects-0.0.4.tar.gz
.
File metadata
- Download URL: ctf-stockobjects-0.0.4.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b293fad27199e8e4d31f23113593a3cb1c0f7aa8698b30c98982fe6564647e0 |
|
MD5 | 42de91d54298fafe593c4e97742dd107 |
|
BLAKE2b-256 | 09c0aebe62446e1c0cdb6f2883a9924cbeee4b3e2516e84efb673d15e1884a52 |
File details
Details for the file ctf_stockobjects-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: ctf_stockobjects-0.0.4-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 100a990a6edaf2dc58ba86bacc18ecbd88b2c2ff35fb18b3bcba55874e3c57ca |
|
MD5 | 18d03053652830e02ffc2c17be2bbea6 |
|
BLAKE2b-256 | 389a9d18fec76582be85d0f7e45fbb54939c08af9dedf9716a55efcfdf039bca |