Skip to content

crypto#

Lunch Money - Crypto

https://lunchmoney.dev/#crypto

CryptoClient #

Bases: LunchMoneyAPIClient

Lunch Money Tag Interactions

Source code in lunchable/models/crypto.py
class CryptoClient(LunchMoneyAPIClient):
    """
    Lunch Money Tag Interactions
    """

    def get_crypto(self) -> List[CryptoObject]:
        """
        Get Crypto Assets

        Use this endpoint to get a list of all cryptocurrency assets associated
        with the user's account. Both crypto balances from synced and manual
        accounts will be returned.

        https://lunchmoney.dev/#get-all-crypto

        Returns
        -------
        List[CryptoObject]
        """
        response_data = self.make_request(
            method=self.Methods.GET, url_path=APIConfig.LUNCHMONEY_CRYPTO
        )
        crypto_data = response_data["crypto"]
        crypto_objects = [CryptoObject.model_validate(item) for item in crypto_data]
        return crypto_objects

    def update_crypto(
        self,
        crypto_id: int,
        name: Optional[str] = None,
        display_name: Optional[str] = None,
        institution_name: Optional[str] = None,
        balance: Optional[float] = None,
        currency: Optional[str] = None,
    ) -> CryptoObject:
        """
        Update a Manual Crypto Asset

        Use this endpoint to update a single manually-managed crypto asset (does not include
        assets received from syncing with your wallet/exchange/etc). These are denoted by
        source: manual from the GET call above.

        https://lunchmoney.dev/#update-manual-crypto-asset

        Parameters
        ----------
        crypto_id: int
            ID of the crypto asset to update
        name: Optional[str]
            Official or full name of the account. Max 45 characters
        display_name: Optional[str]
            Display name for the account. Max 25 characters
        institution_name: Optional[str]
            Name of provider that holds the account. Max 50 characters
        balance: Optional[float]
            Numeric value of the current balance of the account. Do not include any
            special characters aside from a decimal point!
        currency: Optional[str]
            Cryptocurrency that is supported for manual tracking in our database

        Returns
        -------
        CryptoObject
        """
        crypto_body = CryptoParamsPut(
            name=name,
            display_name=display_name,
            institution_name=institution_name,
            balance=balance,
            currency=currency,
        ).model_dump(exclude_none=True)
        response_data = self.make_request(
            method=self.Methods.PUT,
            url_path=[
                APIConfig.LUNCHMONEY_CRYPTO,
                APIConfig.LUNCHMONEY_CRYPTO_MANUAL,
                crypto_id,
            ],
            payload=crypto_body,
        )
        crypto = CryptoObject.model_validate(response_data)
        return crypto

get_crypto() #

Get Crypto Assets

Use this endpoint to get a list of all cryptocurrency assets associated with the user's account. Both crypto balances from synced and manual accounts will be returned.

https://lunchmoney.dev/#get-all-crypto

Returns:

Type Description
List[CryptoObject]
Source code in lunchable/models/crypto.py
def get_crypto(self) -> List[CryptoObject]:
    """
    Get Crypto Assets

    Use this endpoint to get a list of all cryptocurrency assets associated
    with the user's account. Both crypto balances from synced and manual
    accounts will be returned.

    https://lunchmoney.dev/#get-all-crypto

    Returns
    -------
    List[CryptoObject]
    """
    response_data = self.make_request(
        method=self.Methods.GET, url_path=APIConfig.LUNCHMONEY_CRYPTO
    )
    crypto_data = response_data["crypto"]
    crypto_objects = [CryptoObject.model_validate(item) for item in crypto_data]
    return crypto_objects

update_crypto(crypto_id, name=None, display_name=None, institution_name=None, balance=None, currency=None) #

Update a Manual Crypto Asset

Use this endpoint to update a single manually-managed crypto asset (does not include assets received from syncing with your wallet/exchange/etc). These are denoted by source: manual from the GET call above.

https://lunchmoney.dev/#update-manual-crypto-asset

Parameters:

Name Type Description Default
crypto_id int

ID of the crypto asset to update

required
name Optional[str]

Official or full name of the account. Max 45 characters

None
display_name Optional[str]

Display name for the account. Max 25 characters

None
institution_name Optional[str]

Name of provider that holds the account. Max 50 characters

None
balance Optional[float]

Numeric value of the current balance of the account. Do not include any special characters aside from a decimal point!

None
currency Optional[str]

Cryptocurrency that is supported for manual tracking in our database

None

Returns:

Type Description
CryptoObject
Source code in lunchable/models/crypto.py
def update_crypto(
    self,
    crypto_id: int,
    name: Optional[str] = None,
    display_name: Optional[str] = None,
    institution_name: Optional[str] = None,
    balance: Optional[float] = None,
    currency: Optional[str] = None,
) -> CryptoObject:
    """
    Update a Manual Crypto Asset

    Use this endpoint to update a single manually-managed crypto asset (does not include
    assets received from syncing with your wallet/exchange/etc). These are denoted by
    source: manual from the GET call above.

    https://lunchmoney.dev/#update-manual-crypto-asset

    Parameters
    ----------
    crypto_id: int
        ID of the crypto asset to update
    name: Optional[str]
        Official or full name of the account. Max 45 characters
    display_name: Optional[str]
        Display name for the account. Max 25 characters
    institution_name: Optional[str]
        Name of provider that holds the account. Max 50 characters
    balance: Optional[float]
        Numeric value of the current balance of the account. Do not include any
        special characters aside from a decimal point!
    currency: Optional[str]
        Cryptocurrency that is supported for manual tracking in our database

    Returns
    -------
    CryptoObject
    """
    crypto_body = CryptoParamsPut(
        name=name,
        display_name=display_name,
        institution_name=institution_name,
        balance=balance,
        currency=currency,
    ).model_dump(exclude_none=True)
    response_data = self.make_request(
        method=self.Methods.PUT,
        url_path=[
            APIConfig.LUNCHMONEY_CRYPTO,
            APIConfig.LUNCHMONEY_CRYPTO_MANUAL,
            crypto_id,
        ],
        payload=crypto_body,
    )
    crypto = CryptoObject.model_validate(response_data)
    return crypto

CryptoObject #

Bases: LunchableModel

Crypto Asset Object

https://lunchmoney.dev/#crypto-object

Parameters:

Name Type Description Default
id int

Unique identifier for a manual crypto account (no ID for synced accounts)

required
zabo_account_id int | None

Unique identifier for a synced crypto account (no ID for manual accounts, multiple currencies may have the same zabo_account_id)

None
source str

synced (this account is synced via a wallet, exchange, etc.) or manual (this account balance is managed manually)

required
name str

Name of the crypto asset

required
display_name str | None

Display name of the crypto asset (as set by user)

None
balance float

Current balance

required
balance_as_of datetime | None

Date/time the balance was last updated in ISO 8601 extended format

None
currency str | None

Abbreviation for the cryptocurrency

None
status str | None

The current status of the crypto account. Either active or in error.

None
institution_name str | None

Name of provider holding the asset

None
created_at datetime

Date/time the asset was created in ISO 8601 extended format

required
Source code in lunchable/models/crypto.py
class CryptoObject(LunchableModel):
    """
    Crypto Asset Object

    https://lunchmoney.dev/#crypto-object
    """

    id: int = Field(description=_CryptoDescriptions.id)
    zabo_account_id: Optional[int] = Field(
        None, description=_CryptoDescriptions.zabo_account_id
    )
    source: str = Field(description=_CryptoDescriptions.source)
    name: str = Field(description="Name of the crypto asset")
    display_name: Optional[str] = Field(
        None, description=_CryptoDescriptions.display_name
    )
    balance: float = Field(description="Current balance")
    balance_as_of: Optional[datetime.datetime] = Field(
        None, description=_CryptoDescriptions.balance_as_of
    )
    currency: Optional[str] = Field(
        None, description="Abbreviation for the cryptocurrency"
    )
    status: Optional[str] = Field(None, description=_CryptoDescriptions.status)
    institution_name: Optional[str] = Field(
        default=None, description="Name of provider holding the asset"
    )
    created_at: datetime.datetime = Field(description=_CryptoDescriptions.created_at)

CryptoParamsPut #

Bases: LunchableModel

https://lunchmoney.dev/#update-manual-crypto-asset

Parameters:

Name Type Description Default
name str | None
None
display_name str | None
None
institution_name str | None
None
balance float | None
None
currency str | None
None
Source code in lunchable/models/crypto.py
class CryptoParamsPut(LunchableModel):
    """
    https://lunchmoney.dev/#update-manual-crypto-asset
    """

    name: Optional[str] = None
    display_name: Optional[str] = None
    institution_name: Optional[str] = None
    balance: Optional[float] = None
    currency: Optional[str] = None