GetPositions
GetPositions returns holdings of securities and cash positions on accounts. Each entry (GetPositionResponseRow) in the answer contains identifier for the Account and Asset, ie cash or instrument.
Each field is explained in the definition of GetPositionResponseRow below:
Filter inputs
Name | Type | Description | Mandatory | Available from version |
---|---|---|---|---|
BalanceDate | DateTime? | Balance date | Yes | |
DisplayCurrencyCode | String | ISO-code for DisplayCurrency. For explanation look at the fields in the table for the response rows. | Yes | |
AccountDimensionKey | String | "T" for traded, "S" for settled and "A" for accounting | Yes | |
Accounts | Guid[] | Filter by array of accounts, to show holdings. | ||
AccountTypeKeys | String[] | Filter by array of AccountTypeKeys | ||
AccountNo | String | Filter by account number | ||
AccountOwner | Guid? | Filter by account owner | ||
Assets | Guid[] | Filter by array of assets (Cash or Instrument) | ||
Asset | Guid? | Filter by single asset (Cash or Instrument) | ||
AssetTypeKeys | string[] | Filter by array of asset type keys (Cash or GenericInstrument) | ||
InstrumentTypes | int[] | Filter by array of instrument types |
Response rows (Array)
Name | Type | Description | Available from version |
---|---|---|---|
Account | Guid | The account id | |
Asset | Guid | The id of the cash or instrument | |
AssetType | String | Cash means currency assets like SEK, EUR etc. while GenericInstrument means securities like Stocks, Bonds etc. The type of asset can then be found by sending the Asset GUID as the AssetID to GetInstruments | |
BalanceDate | DateTime | Balance date | |
Amount | Decimal | Size of the amount (amount for cash and number of shares of the instrument) | |
AccountTypeKey | String | Type of account, i.e. "HoldingAccount". | |
AcquisitionValue | Double | Acquisition value of the position, in the instruments currency. | |
AcquisitionValueAccountCurrency | Double | Acquisition value of the account currency. | |
Opened | DateTime | Time when the position was created | |
AccountDimensionKey | String | Account dimension, "T"=trade balance, "S" = settle balance, "A"=booked balance | |
Price | Double | Price of the asset. Cash is always 1.0. If 'BalanceDate' is todays date will current price be used (yesterday's closing price) or else the closing price for 'BalanceDate' or if the price is missing from BalanceDate, previous closing price. | |
FxRate | Double | The exchange rate of the instrument/cash | |
BaseRate | Double | The exchange rate of the accounts base rate. | |
DisplayCurrencyCode | String | Display currency | |
DisplayRate | Double | Exchange rate for the base rate | |
MarketValue | Double | Market value of the instrument /cash currency. For cash it´s always the same as the amount. | |
MarketValueAccountCurrency | Double | Market value in the account currency | |
MarketValueDisplayCurrency | Double | Market value in the display currency | |
PreviousMarketValue | Double | Value of the position of the previous closing price. | |
PreviousMarketValueDisplayCurrency | Double | Value of the position of the previous closing price (display currency) | |
MarketValueChange | Double | Market value change between the previous closing price and the last closing price. | |
AcquisitionValueDisplayCurrency | Double | Acquisition value in display currency | |
AcquisitionPrice | Double | AcquisitionPrice | |
AcquisitionPriceAccountCurrency | Double | Acquisition price in the base rate of the account | |
AcquisitionPriceDisplayCurrency | Double | Acquisition price in the base rate | |
ReturnValue | Double | Return Value, acquisition price | |
ReturnValueAccountCurrency | Double | Return value in the base rate of the account | |
ReturnValueDisplayCurrency | Double | Return value in the display currancy. | |
ReturnPercentage | Double | Return value divided with the acquisition price | |
ReturnPercentageAccountCurrency | Double | Return value divided with the acquisition price in the base rate of the account | |
ReturnPercentageDisplayCurrency | Double | Return value divided with the acquisition price | |
ReservedAmount | Decimal | Reserved amount. Amount of current availability reserved. Cash is reserved to buy orders and instrument is reserved to sell orders. | |
AvailableAmount | Decimal | Available amount | |
Account_AccountNo | string | The account number | |
DisplayPercentagePrice | Bool | If the price should be displayed in percentage terms | 2.02 |
DisplayMultiplier | Decimal | The multiplier used to multiply the price for display purposes | 2.02 |
ValueMultiplier | Decimal | The multiplier used to multiply the value of the position for valuation purposes | 2.02 |
XML request example
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetPositions xmlns="http://tempuri.org/">
<req>
<Credentials>
<UserName>yourusername</UserName>
<Password>yourpassword</Password>
</Credentials>
<identify>youridentifier</identify>
<Args>
<BalanceDate>2015-10-23T16:21:59.1659611+02:00</BalanceDate>
<DisplayCurrencyCode>SEK</DisplayCurrencyCode>
<AccountNo>95708006170</AccountNo>
<AccountOwner xsi:nil="true" />
<Asset xsi:nil="true" />
<InstrumentType xsi:nil="true" />
</Args>
<Fields>
<Account>true</Account>
<Asset>true</Asset>
<BalanceDate>false</BalanceDate>
<Amount>true</Amount>
<AcquisitionValue>true</AcquisitionValue>
<AcquisitionValueAccountCurrency>true</AcquisitionValueAccountCurrency>
<Opened>false</Opened>
<AccountDimensionKey>false</AccountDimensionKey>
<Price>true</Price>
<FxRate>false</FxRate>
<BaseRate>false</BaseRate>
<DisplayCurrency>false</DisplayCurrency>
<MarketValue>true</MarketValue>
<MarketValueAccountCurrency>true</MarketValueAccountCurrency>
<MarketValueDisplayCurrency>true</MarketValueDisplayCurrency>
<PreviousMarketValue>false</PreviousMarketValue>
<PreviousMarketValueDisplayCurrency>false</PreviousMarketValueDisplayCurrency>
<MarketValueChange>false</MarketValueChange>
<AcquisitionValueDisplayCurrency>false</AcquisitionValueDisplayCurrency>
<AcquisitionPrice>true</AcquisitionPrice>
<AcquisitionPriceAccountCurrency>true</AcquisitionPriceAccountCurrency>
<AcquisitionPriceDisplayCurrency>false</AcquisitionPriceDisplayCurrency>
<ReturnValue>true</ReturnValue>
<ReturnValueAccountCurrency>false</ReturnValueAccountCurrency>
<ReturnValueDisplayCurrency>false</ReturnValueDisplayCurrency>
<ReturnPercentage>false</ReturnPercentage>
<ReturnPercentageAccountCurrency>false</ReturnPercentageAccountCurrency>
<ReturnPercentageDisplayCurrency>false</ReturnPercentageDisplayCurrency>
<DisplayRate>false</DisplayRate>
<ReservedAmount>false</ReservedAmount>
<AvailableAmount>false</AvailableAmount>
<AssetType>true</AssetType>
<Account_AccountNo>true</Account_AccountNo>
</Fields>
</req>
</GetPositions>
</s:Body>
</s:Envelope>
C# - Get positions for a specific account
var credentials = new Credentials
{
UserName = "UserName",
Password = "Password"
};
var getPositionsRequest = new GetPositionRequest
{
Credentials = credentials,
identify = "uniqueIdentifierForYourBfsInstance",
Args = new GetPositionArgs
{
DisplayCurrencyCode = "SEK",
AccountDimensionKey = "T",
BalanceDate = DateTime.Now,
AccountOwner = Guid.Parse("79b7b7a1-eb5f-45b1-9246-bf7b459b544f")
},
Fields = new GetPositionFields
{
Account = true,
BalanceDate = true,
Asset = true,
AssetType = true,
Amount = true,
AcquisitionValue = true,
AcquisitionValueAccountCurrency = true,
Price = true
}
};
var response = client.GetPositions(getPositionsRequest);
foreach (var position in response.Result)
{
Console.WriteLine($"AccountId: {position.Account}");
Console.WriteLine($"BalanceDate: {position.BalanceDate}");
Console.WriteLine($"Asset: {position.Asset}");
Console.WriteLine($"AssetType: {position.AssetType}");
Console.WriteLine($"Amount: {position.Amount}");
Console.WriteLine($"AcquisitionValue : {position.AcquisitionValue}");
Console.WriteLine($"AcquisitionValueAccountCurrency : {position.AcquisitionValueAccountCurrency}");
Console.WriteLine($"Price: {position.Price}");
}
Blog Posts
Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved