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 Key figures:
| 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>
Key figure Example - KeyFigure_TaxFreeReturn
It returns all the accounts that has a given position at that BalanceDate for that LegalEntity that is put into the AccountOwner field. AssetTypeKeys and DisplayCurrencyCode is a safe way to prevent future features that allow the account to have instrument with keyfigures.
If the person has an account and it has Zero in the position, it will NOT return a row for that account.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPositions xmlns="http://tempuri.org/">
<req>
<Credentials>
<UserName>{{UserName}}</UserName>
<Password>{{Password}}</Password>
</Credentials>
<identify>{{Identify}}</identify>
<Args>
<BalanceDate>2025-05-22T16:21:59.1659611+02:00</BalanceDate>
<DisplayCurrencyCode>NOK</DisplayCurrencyCode>
<AssetTypeKeys>
<string>Cash</string>
</AssetTypeKeys>
<AccountDimensionKey>KeyFigure_TaxFreeReturn</AccountDimensionKey>
<AccountOwner>6fc56079-0e4e-4191-919a-1e45f63b716a</AccountOwner>
<AccountNo xsi:nil="true" />
<Asset xsi:nil="true" />
<InstrumentType xsi:nil="true" />
</Args>
<Fields>
<Account>true</Account>
<Asset>true</Asset>
<BalanceDate>true</BalanceDate>
<Amount>true</Amount>
<AssetType>true</AssetType>
<Account_AccountNo>true</Account_AccountNo>
<Opened>true</Opened>
<AcquisitionValue>false</AcquisitionValue>
<AcquisitionValueAccountCurrency>false</AcquisitionValueAccountCurrency>
<AccountDimensionKey>false</AccountDimensionKey>
<Price>false</Price>
<FxRate>false</FxRate>
<BaseRate>false</BaseRate>
<DisplayCurrency>false</DisplayCurrency>
<MarketValue>false</MarketValue>
<MarketValueAccountCurrency>false</MarketValueAccountCurrency>
<MarketValueDisplayCurrency>false</MarketValueDisplayCurrency>
<PreviousMarketValue>false</PreviousMarketValue>
<PreviousMarketValueDisplayCurrency>false</PreviousMarketValueDisplayCurrency>
<MarketValueChange>false</MarketValueChange>
<AcquisitionValueDisplayCurrency>false</AcquisitionValueDisplayCurrency>
<AcquisitionPrice>false</AcquisitionPrice>
<AcquisitionPriceAccountCurrency>false</AcquisitionPriceAccountCurrency>
<AcquisitionPriceDisplayCurrency>false</AcquisitionPriceDisplayCurrency>
<ReturnValue>false</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>
</Fields>
</req>
</GetPositions>
</soap:Body>
</soap:Envelope>Response example
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetPositionsResponse xmlns="http://tempuri.org/">
<GetPositionsResult>
<Message>OK</Message>
<Result>
<GetPositionResponseRow>
<Account>53af9098-e5c6-4f4c-910c-4d0bb3d873d8</Account>
<Asset>b1af7b65-cd9c-4f9d-b14b-afe3f72007b6</Asset>
<BalanceDate>2025-05-22T14:21:59Z</BalanceDate>
<Amount>6000</Amount>
<AcquisitionValue>0</AcquisitionValue>
<AcquisitionValueAccountCurrency>0</AcquisitionValueAccountCurrency>
<Opened>2025-01-20T00:00:00Z</Opened>
<Price>0</Price>
<FxRate>0</FxRate>
<BaseRate>0</BaseRate>
<MarketValue>0</MarketValue>
<MarketValueAccountCurrency>0</MarketValueAccountCurrency>
<MarketValueDisplayCurrency>0</MarketValueDisplayCurrency>
<PreviousMarketValue>0</PreviousMarketValue>
<PreviousMarketValueDisplayCurrency>0</PreviousMarketValueDisplayCurrency>
<MarketValueChange>0</MarketValueChange>
<AcquisitionValueDisplayCurrency>0</AcquisitionValueDisplayCurrency>
<AcquisitionPrice>0</AcquisitionPrice>
<AcquisitionPriceAccountCurrency>0</AcquisitionPriceAccountCurrency>
<AcquisitionPriceDisplayCurrency>0</AcquisitionPriceDisplayCurrency>
<ReturnValue>0</ReturnValue>
<ReturnValueAccountCurrency>0</ReturnValueAccountCurrency>
<ReturnValueDisplayCurrency>0</ReturnValueDisplayCurrency>
<ReturnPercentage>0</ReturnPercentage>
<ReturnPercentageAccountCurrency>0</ReturnPercentageAccountCurrency>
<ReturnPercentageDisplayCurrency>0</ReturnPercentageDisplayCurrency>
<DisplayRate>0</DisplayRate>
<ReservedAmount>0</ReservedAmount>
<AvailableAmount>0</AvailableAmount>
<AssetType>Cash</AssetType>
<ValueMultiplier>0</ValueMultiplier>
<DisplayMultiplier>0</DisplayMultiplier>
<DisplayPercentagePrice>false</DisplayPercentagePrice>
<Account_AccountNo>10018234</Account_AccountNo>
</GetPositionResponseRow>
<GetPositionResponseRow>
<Account>867d45b2-609b-4a6e-a8c7-a94d472b7870</Account>
<Asset>b1af7b65-cd9c-4f9d-b14b-afe3f72007b6</Asset>
<BalanceDate>2025-05-22T14:21:59Z</BalanceDate>
<Amount>10000</Amount>
...
<Opened>2025-01-21T00:00:00Z</Opened>
...
<AssetType>Cash</AssetType>
...
<Account_AccountNo>10018235</Account_AccountNo>
</GetPositionResponseRow>
<GetPositionResponseRow>
<Account>351b1190-ebba-46b4-9d66-77e36212da44</Account>
<Asset>b1af7b65-cd9c-4f9d-b14b-afe3f72007b6</Asset>
<BalanceDate>2025-05-22T14:21:59Z</BalanceDate>
<Amount>211455.9</Amount>
...
<Opened>2023-12-31T00:00:00Z</Opened>
...
<AssetType>Cash</AssetType>
...
<Account_AccountNo>10018236</Account_AccountNo>
</GetPositionResponseRow>
<GetPositionResponseRow>
<Account>5142ee41-fb94-47fb-b36c-fd90042e716c</Account>
<Asset>b1af7b65-cd9c-4f9d-b14b-afe3f72007b6</Asset>
<BalanceDate>2025-05-22T14:21:59Z</BalanceDate>
<Amount>15000</Amount>
...
<Opened>2025-05-13T00:00:00Z</Opened>
...
<AssetType>Cash</AssetType>
...
<Account_AccountNo>10018237</Account_AccountNo>
</GetPositionResponseRow>
<GetPositionResponseRow>
<Account>841f8c4b-d71f-40bd-abd2-d9abcd971b0d</Account>
<Asset>b1af7b65-cd9c-4f9d-b14b-afe3f72007b6</Asset>
<BalanceDate>2025-05-22T14:21:59Z</BalanceDate>
<Amount>70000</Amount>
...
<Opened>2025-05-12T00:00:00Z</Opened>
...
<AssetType>Cash</AssetType>
...
<Account_AccountNo>10018238</Account_AccountNo>
</GetPositionResponseRow>
</Result>
<Fields>
<Account>true</Account>
<Asset>true</Asset>
<BalanceDate>true</BalanceDate>
<Amount>true</Amount>
<AcquisitionValue>false</AcquisitionValue>
<AcquisitionValueAccountCurrency>false</AcquisitionValueAccountCurrency>
<Opened>true</Opened>
<AccountDimensionKey>false</AccountDimensionKey>
<Price>false</Price>
<FxRate>false</FxRate>
<BaseRate>false</BaseRate>
<DisplayCurrencyCode>false</DisplayCurrencyCode>
<MarketValue>false</MarketValue>
<MarketValueAccountCurrency>false</MarketValueAccountCurrency>
<MarketValueDisplayCurrency>false</MarketValueDisplayCurrency>
<PreviousMarketValue>false</PreviousMarketValue>
<PreviousMarketValueDisplayCurrency>false</PreviousMarketValueDisplayCurrency>
<MarketValueChange>false</MarketValueChange>
<AcquisitionValueDisplayCurrency>false</AcquisitionValueDisplayCurrency>
<AcquisitionPrice>false</AcquisitionPrice>
<AcquisitionPriceAccountCurrency>false</AcquisitionPriceAccountCurrency>
<AcquisitionPriceDisplayCurrency>false</AcquisitionPriceDisplayCurrency>
<ReturnValue>false</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>
<DisplayMultiplier>false</DisplayMultiplier>
<DisplayPercentagePrice>false</DisplayPercentagePrice>
<Account_AccountNo>true</Account_AccountNo>
<ValueMultiplier>false</ValueMultiplier>
<CreatedDate>false</CreatedDate>
<AccountTypeKey>false</AccountTypeKey>
</Fields>
</GetPositionsResult>
</GetPositionsResponse>
</soap:Body>
</soap: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 stream
Create a blog post to share news and announcements with your team and company.
Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved