Skip to main content

Price database storage for commodities

Project description

# price-database

A simple Python library and a CLI for storage of prices

The purpose of this project is to provide a storage and means of accessing a price database. It can be reused among multiple projects.

The goal is very simple: separate a storage of prices of various elements (commodities) from other applications or components.

The Price object has several properties:

  • unique identifier = uniquely identifies each record for ease of accessing

  • namespace = distinguishes the namespace for the symbol. Often the exchange name.

  • symbol = security/commodity symbol that identifies it within the namespace (exchange).

  • date = The date of the price

  • time = The time of the price

  • value = Value in currency

  • currency identifier = identifier for the currency. Can be anything the remote system is using.

With these, it should be possible to store prices for commodities used in GnuCash, GnuCash Portfolio, Asset Allocation and other similar financial packages.

## Development

I’m toggling between using PyCharm and Visual Studio Code, with the following libraries:

  • pylint,

  • pytest,

  • rope, for refactoring

## Installation

pip install -e .

Then manually copy the data/prices-template.db into data/prices.db.

Running commands like pricedb list for the first time, will create pricedb.ini file in your home directory. Once created, edit the file and add the required values, like the database path and/or the API keys for online services.

### Configuration

PriceDb expects to find a configuration file “pricedb.ini” in the user’s profile directory. It will create one if it doesn’t find it, but you need to supply the values before the application is functional. At a minimum, provide the path to the database file.

## Running

pricedb

is a command-line interface to all the provided functionality. Using Python, the PriceDbApplication class is the front-end, providing the same functionality through code.

Example:

pricedb import dataAUD_2017-11-11_142445.csv AUD -v DEBUG

## Logging

click-log package is used to provide log output. Simply enable by passing

-v LEVEL

to the command line, where LEVEL is one of the logging levels. Use empty -v option for details.

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

PriceDb-2.4.2.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PriceDb-2.4.2-py2.py3-none-any.whl (29.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file PriceDb-2.4.2.tar.gz.

File metadata

  • Download URL: PriceDb-2.4.2.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for PriceDb-2.4.2.tar.gz
Algorithm Hash digest
SHA256 c6f12f2ae43d31f2c1be96c22dd00555592fd3db39b5f20d4ed0c93418831d06
MD5 71ae2a392384fda5e66f0e8ba923591d
BLAKE2b-256 a31e9690dbbe3857e529eeba06f6a3bb380f6001015592a1dbe06ff658f81815

See more details on using hashes here.

File details

Details for the file PriceDb-2.4.2-py2.py3-none-any.whl.

File metadata

  • Download URL: PriceDb-2.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for PriceDb-2.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 947351acadb79622694995123768a15d80fa8030ad18ff3859ca49d388dee041
MD5 33b05a53b4e2d1a3d9f44653c8b7d243
BLAKE2b-256 fc9f9f4d69fc517e35c0d2412090ccfac27f0ccaf7e6b9a69352041f3f1bf37b

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