Closed tomnewg closed 9 months ago
@tomnewg thank you for the request. I have just attached the doc zip file on the release page. Can you please try to download from https://github.com/alpacahq/alpaca-py/releases/tag/v0.13.3 ? You can find index.html in the archive as a top page of doc.
Sorry if I wasn't clear. I meant documents in my trading account such as trade confirmation. Is there a way to download these pdfs with the SDK? Checking the API documents it should be possible to download them: https://docs.alpaca.markets/reference/downloaddocfromaccount
@tomnewg thank you for the comment. sorry, missed your question.
You can try to use get_trade_documents_for_account()
to get list of documents for a specified account.
Then, download_trade_document_for_account_by_id
to download document by specifying document id and account id.
Sorry, I haven't tested buy you can try similar to below
# download documents for specified accounts
from alpaca.broker.client import BrokerClient
BROKER_API_KEY = "BROKER API KEY"
BROKER_API_SECRET = "BROKER API SECRET"
isSandbox = True
account_id = "TARGET ACCOUNT ID"
download_dir = "/tmp"
client = BrokerClient(api_key=BROKER_API_KEY, secret_key=BROKER_API_SECRET, sandbox=isSandbox)
# get list of document for an account
list_of_docs = client.get_trade_documents_for_account(account_id=account_id)
print(list_of_docs)
for doc in list_of_docs:
document_id = doc.id
download_file_path = f"{download_dir}/{account_id}_{doc.name}"
client.download_trade_document_for_account_by_id(account_id=account_id, document_id=document_id, file_path=download_file_path)
Question form pre-submit checklist.
Question
Is there a way to download documents with the SDK? checking the API it is possible.
Many thanks
Tom