Package: tangany_settlement_api_sdk
Tangany Settlement API Python SDKUnofficial Python SDK for consuming Tangany Settlement API.InstallationTo install the SDK, you can use pip:pipinstalltangany_settlement_api_sdkUsageInitializationFirst, import the SDK:fromtangany_settlement_api_sdkimportSettlementClientfromtangany_settlement_api_sdk.authimportCredentialsInitialize the SDK by providing API credentials and create a Settlement API client:credentials=Credentials(client_id="xxx",client_secret="yyy")api=SettlementClient(credentials=credentials)ExamplesThere is ajupyter notebook filewith all examples, here is an excerpt of some examples to demonstrate how to use the SDK:AccountsCreate accountsapi.accounts.create(id="00000001",label="Satoshi Nakamoto's account",type="internal")Update account labelapi.accounts.update(id="00000001",op="replace",path="/label",value="Satoshi Nakamoto's HODL account")List all account idsaccount_ids=[]next_page_token=""whilenext_page_token!=None:results=api.accounts.list(next_page_token)next_page_token=results['nextPageToken']forresultinresults['items']:account_ids.append(result['id'])Delete accountsapi.accounts.delete(id="00000001")AssetsGet all asset idsapi=SettlementClient(credentials=credentials)asset_ids=[]forassetinapi.assets.list()['items']:asset_ids.append(asset['id'])Get a specific assetresult=api.assets.get(id="BTC")LedgersCreate ledgerapi.ledgers.create("Test","My test ledger")List ledgersresult=api.ledgers.list()Get a specific ledgerresult=api.ledgers.get(id="Test")TransactionsCreate a virtual transactionapi.transactions.create(ledger_id="Test",transaction_id="TX_SAMPLE",from_account_id="00000001",to_account_id="00000002",value_date="2023-11-11T15:00:00.000Z",asset_id="BTC",value="1.0",fiat_currency="EUR",fiat_value="30000.00",reference="BTC-REF",trade_info_fill_date="2023-11-10T15:00:00.000Z",trade_info_market_maker_tx_id="123456789")Get a single transactionresult=api.transactions.get(ledger_id="Test",transaction_id="TX_SAMPLE")Get all transactions for a specific account idtransactions=[]next_page_token=""whilenext_page_token!=None:results=api.transactions.list(ledger_id="Test",involving_account_id="00000001",next_page_token=next_page_token)next_page_token=results['nextPageToken']forresultinresults['items']:transactions.append(result)Get all transactions after a specific booking datetransactions=[]next_page_token=""whilenext_page_token!=None:results=api.transactions.list(ledger_id="Test",booking_date_after="2023-11-11",next_page_token=next_page_token)next_page_token=results['nextPageToken']forresultinresults['items']:transactions.append(result)Delete a single transaction (mark as cancelled)api.transactions.delete(ledger_id="Test",transaction_id="TX_SAMPLE")FundingsSync on-chain deposit as virtual transaction (create deposit)api.funding_deposits.create(ledger_id="Test",transaction_id=f"TX_GENESIS",to_account_id="00000001",value_date="2023-11-11T15:00:00.000Z",asset_id="BTC",value="1.0",fiat_currency="EUR",fiat_value="30000.00",reference="BTC-REF",txHash="0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f")List fundingstransactions=[]next_page_token=""whilenext_page_token!=None:results=api.fundings.list(ledger_id="Test",next_page_token=next_page_token)next_page_token=results['nextPageToken']forresultinresults['items']:transactions.append(result)BalancesList all account balancesaccount_balances=[]next_page_token=""whilenext_page_token!=None:results=api.account_balances.list(ledger_id="Test",valuta_date="2023-11-12",next_page_token=next_page_token)next_page_token=results['nextPageToken']forresultinresults['items']:account_balances.append(result)Get single account balanceresult=api.account_balances.get(ledger_id="Test",account_id="00000001")Get ledger balance of all assetsresult=api.asset_balances.get(ledger_id="Test")ReportsCreate immediate reportapi.reports.create(id="report1",type="account_balances_v1",format="csv",ledger_id="Test",date="2023-11-13")List all reportsresult=api.reports.list()Get a single reportresult=api.reports.get(id="report1")List report resultsresult=api.report_results.list("report1")Download a reportresult=api.report_results.get(report_id="report1",result_id="2023-11-17T12:07:00Z")Delete reportresult=api.reports.delete(id="report1")ChangelogAll notable changes to this project are documented in thechangelogTestingFor testing provide your credentials toexamples.ipynband run the notebook.DeploymentTo release a new version of this SDK please update the version contained in thepyproject.tomlfile.
After testing just usepoetryto build and publish a new version topypi.org:poetry build
poetry publishAPI documentationFull API documentation is available athttps://docs.tangany.com© 2023Tangany GmbHImprint•Legal & privacy•Newsletter•Twitter•Facebook•LinkedIn•YouTube•Github