History Object¶
The history sdk endpoint pertains specifically to factor values through history. This data is passed through the Upload object with an upload type of 'ME_HISTORY'. The history object contains the following data:
Data | Description | Data Type |
---|---|---|
Name | Name of history version | String |
Description | Description of history version | String |
Version | Version of history | Integer |
History by Date Data | Historical factor data | Structure |
From the history endpoint, any value from that history can be retrieved. The values are separated first by date and then by variable/column name. For further explanation, see the examples below.
The history object can be retrieved by passing the object's unique numeric identifier to the GetHistory function in Golang or the get_history function in Python.
Get History Object, Golang Example¶
historyDetails, err :=sdkClient.GetHistory(HistoryID)
if err != nil {
log.Fatal(err)
}
Get History Object, Python Example¶
from sdk import history
history_id = 1
myhistory = history.get_history(history_id)
history_data=myhistory.MapDateHistory
history_values=history_data.get(datetime.datetime(2011,6,30,0,0)).MapHistoryValue
>>> myhistory.Name
US History
>>> history_values["mort_30y_rate"]
4.7