Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement price() and price_history() #68

Closed
AlexTheWizardL opened this issue Aug 6, 2024 · 2 comments · Fixed by #70
Closed

Implement price() and price_history() #68

AlexTheWizardL opened this issue Aug 6, 2024 · 2 comments · Fixed by #70

Comments

@AlexTheWizardL
Copy link
Collaborator

AlexTheWizardL commented Aug 6, 2024

This issue covers creating price() and price_history() methods that are described in the abstract class

General understanding:

In previous meetings, we've decided that add_price() and delete_price methods are not available in the cashctrl system (this is now mentioned in the milestone description).

In the Standalone_Ledger, these prices are stored as a class field called _prices. Price entity can contain ticker, currency, price, and date fields.

Ticker is a concept that can be represented by any name and has some price. For example ticker - cow can cost 100 USD, ticker cat can cost 10 UAH. Also, that price can vary in time, for example in 2024 cow costs 100 USD but in 2025 it costs 200 USD

Following questions:

  1. Where price along with ticker should be stored in the scope of Cashctrl_ledger?
  2. If the add_price() method is not available in the cashctrl system then what sense of get methods if we can not create a price?
  3. Is there any corresponding entity that exists in the cashctrl system?
@AlexTheWizardL
Copy link
Collaborator Author

AlexTheWizardL commented Aug 8, 2024

Proposed solution and understanding:

  • Ticker in this issue scope would be currencies
  • Price would return just exchange rate
  • Interface for price(currency: str, date: date.datetime) -> float; would return just one value via API call for exchange rate
  • Interface for price_history(currency: str) -> pd.DataFrame, would return df with a price and date columns that will correspond to price change along the history

@AlexTheWizardL
Copy link
Collaborator Author

After trying to implement this issue I've discovered new pitfalls of the Cashctrl API:

  • There is no way to receive a history of price changes. The "currency/exchangerate" endpoint is the only one to calculate the exchange rate and it returns only one float value at a time
  • My goal was to test an exchange rate for a created currency. After creating a custom currency using the currency/create.json endpoint and trying to receive its rate from the "currency/exchangerate" endpoint it returns an empty string and doesn't see a new currency

@AlexTheWizardL AlexTheWizardL linked a pull request Aug 14, 2024 that will close this issue
@AlexTheWizardL AlexTheWizardL removed a link to a pull request Aug 15, 2024
@AlexTheWizardL AlexTheWizardL linked a pull request Aug 15, 2024 that will close this issue
@lasuk lasuk closed this as completed in #70 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant