Notifications
(For manual trading, this is the preferred notification type.)


Webhook
(For automated trading, this is the preferred notification type.)Listen for eventsSample Code [Python] (AWS Lambda):
def lambda_handler(event, _):
signals = json.loads(event['body'])
headers = event['headers']
is_legit = False
# grab this from forcepu.sh/docs
my_api_key = 'this_is_a_secret'
if headers['X-API-Key'] == my_api_key:
is_legit = True
signal = signals[0]
if is_legit:
if signal['Signal'] == 'BUY':
# implement buying logic
pass
else:
# implement selling logic
pass
print(json.dumps(signals, indent=4))
# [
# {
# "Asset": "BTC",
# "Date": "2020-01-01",
# "Day": "Wed",
# "Signal": "BUY"
# }
# ]
return {
'statusCode': 200,
'body': 'OK'
}