Trade confirmation data

Haven’t found it on our own yet but wondering if anyone knows how to pull the trade confirmation data from either the paper or live api from the transaction history other than logging it manually or using a json-like scrape off the dashboard.
Thanks.
RB.

look into

also for the v2 api

#duh
#duh
#duh
#duh
#duh
#duh

Body seems unclear, is it a complete sentence?
Yes.

@trykrb are you looking for actual trade confirmation PDF files or are you trying to get trade executions as data?

Was looking for the current average position price as shown in the dashboard to build a dollar cost averaging buy/sell algo.
Probably a stupid question. May have found the answer in a sample off medium.

We are actually rolling out this new API endpoint to get all the order fills. Does this help?

1 Like

We saw this. Already wrote the code we needed for a test run. Seems to work well enough.

def dumpPosition(AlpacaClient):
rv = False
try:
position = AlpacaClient.get_position(TARGET_SYMBOL)

    if position:
        if (float(position.current_price) - float(position.avg_entry_price)) >= MIN_P_AND_L:
            # Take the profit and run
            rv = True
            logAction('"sell", "{}", {}, {}'.format(TARGET_SYMBOL, position.qty, position.current_price))
except requests.exceptions.HTTPError as re:
    print("{}".format(re))
except alpaca_trade_api.rest.APIError as ae:
    print("{}".format(ae))
return rv
1 Like