Skip to main content

Python Package for reading a amibroker database

Project description

ami2py

Build Status Code style: black PyPi version PyPi downloads License: MIT ami2py

Python Package for reading and writing from and to an amibroker database.
This package is using construct for defining the binary structures used to access the amibroker database, see Construct documentation.
The specification of the binary structure was taken from the official amibroker C++ sdk api documentation.

However, this is not an official amibroker database api.
Therefore, no warranty is given and handle with care.
Improvement requests are always welcome.
This module can be used to create a database and write symbol data to that.
However, it seems to be a good idea to use the official quote downloader program for productive usage.

Examples

Creating a Database from scratch and adding symbol data to the database.

>>> from ami2py import AmiDataBase, SymbolEntry
>>> db = AmiDataBase(db_folder)
>>> db.add_symbol("AAPL")    
>>> db.append_data_to_symbol(
        "AAPL",
        SymbolEntry(
            Close=200.0,
            High=230.0,
            Low=190.0,
            Open=210.0,
            Volume=200003122.0,
            Month=12,
            Year=2020,
            Day=17,
        ),
    )
>>> db.write_database()

Reading a list of symbols contained in the database.

>>> symbols = db.get_symbols()
>>> symbols
["AAPL"]

Getting values for a symbol in a pandas compatible dicitonary format.

>>> data = aapl = db.get_dict_for_symbol("SPCE")
{
    "Open": [20.0,....],
    "Close": [200.0,....],
    "High": [230.0,.....],
    "Low": [190.0,.....],
    "Open": [210.0,.......],
    "Volume": [200003122.0,.....],
    "Month": [12,.......],
    "Year": [2020,.......],
    "Day": [17,........],
}

Todos

  • Write tests for intraday data, currently data structures is able to handle intraday data. But no tests had been written, until now. This is considered mandatory to reach version 1.0.0
  • Add docstrings to the source code. This seems to be a minor task.
  • Currently no real life performance measures have been done.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ami2py-0.5.1.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file ami2py-0.5.1.tar.gz.

File metadata

  • Download URL: ami2py-0.5.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7

File hashes

Hashes for ami2py-0.5.1.tar.gz
Algorithm Hash digest
SHA256 cf06e683ec2bb8ec33a0f01ba5829d283a5306df29d7954fe8f15f959b4a2d29
MD5 410f7b38c10e06610d430d344fe3fda0
BLAKE2b-256 33daee2d8405e3c90913eb26758d74bfeb73dc811463e21a8fa8be8d2ee1b7cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page