-
Notifications
You must be signed in to change notification settings - Fork 15
Transactions
Toby edited this page May 27, 2020
·
4 revisions
Transactions are set in lusidtools using upsertTransactions.
inst_name | portfolio | currency_code | FIGI | Tx_id | Price | Currency | amount | units | effective_date | settle_date | Broker Name |
---|---|---|---|---|---|---|---|---|---|---|---|
Apple | tech_001 | None | BBG0013T5HY0 | f2g1f45 | 51 | USD | 255 | 500 | 18/11/2019 | 20/11/2019 | B1 |
MICROSOFT CORP | tech_001 | None | BBG007F5XJZ0 | d55sdf5 | 65 | USD | 245 | 250 | 18/11/2019 | 18/11/2019 | B2 |
UBER Tech | tech_002 | None | BBG00NW4HSM1 | o5g18fw | 49 | USD | 448 | 700 | 18/11/2019 | 24/11/2019 | B1 |
USD | tech_002 | USD | yh3527y | 1 | USD | 500 | 500 | 18/11/2019 | 24/11/2019 | B1 |
mapping = {}
mapping["transactions"] = {
"identifier_mapping": {
"Figi": "FIGI",
"Currency": "currency_code"
},
"required": {
"code": "portfolio",
"transaction_id": "Tx_id",
"type": "Transaction Code",
"transaction_price.price": "Price",
"transaction_price.type": "$Price",
"total_consideration.amount": "amount",
"units": "units",
"transaction_date": "effective_Date",
"transaction_currency": "Currency",
"total_consideration.currency": "Currency",
"settlement_date": "settle_date"
},
"optional": {
"source": "$DataProvider"
},
"properties": [
"Broker Name"
]
}
# Load data
txn_df = pd.read_csv("path/to/data/with/transactions.csv")
# Load Transactions
result = lpt.cocoon.load_from_data_frame(
api_factory=api_factory,
scope=scope,
data_frame=txn_df,
mapping_required=mapping["transactions"]["required"],
mapping_optional=mapping["transactions"]["optional"],
file_type="transactions",
identifier_mapping=mapping["transactions"]["identifier_mapping"],
property_columns=mapping["transactions"]["properties"],
properties_scope=scope
)