Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.03 KB

README.md

File metadata and controls

38 lines (26 loc) · 1.03 KB

Alpaca Trading Microservice Communication

The README guidelines below contains instructions for programmatically requesting and receiving data from the microservice.

Requesting Data

To request data from the Alpaca Microservice, you can use the provided Python functions in the alpaca_trading.py file.

from alpaca_trading import place_order

api_key = ""
secret_key = ""
symbol = "AAPL"  # example stock
quantity = 10    # example quantity
side = "buy"     # 'buy' or 'sell' based on your trade type

result = place_order(api_key, secret_key, symbol, quantity, side)
print("Response:")
print(result)

Receiving Data

The Alpaca Microservice provides functions to retrieve open positions, open orders, and more alpaca_trading.py file.

from alpaca_trading import get_account_positions

api_key = ""
secret_key = ""

result = get_account_positions(api_key, secret_key)
print("Account Positions:")
print(result)

UML