Analysis
card_stats(database_path, cid)
Calculates the market value and gain/loss of the input card using the timestamps the prices were recorded in the local SQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_path
|
Path
|
Path to the local SQL collection database. |
required |
cid
|
int
|
cid of card in collection file. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Returns dataframe with schema {"timestamp": pl.String, "market_value": pl.Float64, "profit": pl.Float64}. |
Source code in src/mtg_pynance/analysis.py
collection_extrema(database_path)
Calculates the cards in the collection that currently have the largest gain and loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_path
|
Path
|
Path to the local SQL collection database. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict, dict]
|
Return a tuple of dictionaries where element 0 corresponds to the card with the maximum gain and element 1 corresponds to the card with the maximum loss. The schema for each dictionary is {"cid": [int], "*": float, "purchase_price": float} where * is "gain" or "loss", respectively. |
Source code in src/mtg_pynance/analysis.py
collection_largest_movers(database_path)
Calculates the price movement of each card based on its two most recently recorded prices and returns the cards that have the largest and smallest price movement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_path
|
Path
|
Path to the local SQL collection database. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict, dict]
|
Return a tuple of dictionaries where element 0 corresponds to the card with the maximum gain and element 1 corresponds to the card with the maximum loss. The schema for each dictionary is {"cid": [int], "*": float, "purchase_price": float} where * is "gain" or "loss", respectively. |
Source code in src/mtg_pynance/analysis.py
collection_stats(database_path)
Calculates the market value and gain/loss of the entire collection of cards at the timestamps the prices were recorded in the local SQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_path
|
Path
|
Path to the local SQL collection database. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Returns dataframe with schema {"timestamp": pl.String, "market_value": pl.Float64, "profit": pl.Float64}. |
Source code in src/mtg_pynance/analysis.py
delete_card(database_path, cid)
Deletes card from local SQL database. This includes its price table and purchase price information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_path
|
Path
|
Path to the local SQL collection database. |
required |
cid
|
int
|
cid of card in collection file. |
required |