Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Post marks to Empirasign's Validated Evaluted Pricing (VEP) Service API endpoint
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
post_marks.py
example script showing how to post daily marks to Empirasign's API
endpoint for the VEP (Validated Evaluated Pricing) Service, a crowd sourced
statistically robust tool for outlier detection
To get set up with a Free Trial, contact us at:
info@empirasign.com
+1 646-837-8849
"""
import requests
API_KEY = "{MY_API_KEY}" # provided by Empirasign
API_SECRET = "{MY_API_SECRET}" # provided by Empirasign
API_URL = 'https://api.empirasign.com/validated-pricing/'
MAX_ITEMS = 50000 # cannot post more than 50K items at time
marks = [
{"uid": "56578DAA3", "price": 89.25}, # cusip/isin and price are required
{"uid": "86358EUD6", "price": 78.25, "tag": "legacy-subprime"}, # optional tag
{"uid": "3137FLZX5", "price": 19.95, "delta": 0.75}, # optional delta
{"uid": "57645TAA5", "price": 98.10, "delta": 0.45, "tag": "pl_floater"} # full set
]
data = {'api_key': API_KEY, 'api_secret': API_SECRET, 'bonds': marks[:MAX_ITEMS]}
resp = requests.post(API_URL, json=data)
assert resp.status_code == 200 # make sure all good
print(resp.status_code, resp.text)
# 200 {"meta": {"results": "OK", "errors": {}}, "records_inserted": 4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.