GetHistoricPositions
Filter inputs
Name | Type | Description | Mandatory | Available from version |
---|---|---|---|---|
StartDate | DateTime | Filter by start date | True | |
EndDate | DateTime | Filter by end date | True | |
DisplayCurrencyCode | string | Enter what currency in ISO-format that the results should be retreived in | True | |
AccountDimensionKey | string | Filter by dimension key ("T" for traded, "S" for settled) | True | |
Accounts | Guid[]? | Filter by BfsId of accounts | ||
Assets | Guid[]? | Filter by BfsId of assets | ||
IncludeZeroes | bool | If set to yes, empty and negative positions will be included. Defaultvalue is false if not supplied | 2.20 | |
AssetTypeKeys | string[] | Filter by array of asset type keys (Cash or GenericInstrument) | 2.38 | |
InstrumentTypes | int[] | Filter by array of instrument types | 2.38 |
Response rows (Array) inherits from EntityBase
Name | Type | Description | Available from version |
---|---|---|---|
Account | Guid | BfsId of the account | |
AccountNo | string | The account number for the position | |
Asset | Guid | BfsId of the instrument | |
BalanceDate | DateTime | The balance date of the position | |
Amount | decimal | The amount of the position | |
AccountDimensionKey | string | The dimension of the positon, "T" for traded and "S" for settled | |
Price | double | Price of instrument when position was acquired. | |
FxRate | double | This is the exchange rate used if DisplayCurrency is used. If the currency of the position is EUR and the DisplayCurrency is set to USD this is the exchange rate between EUR and USD | |
BaseRate | double | This is the exchange rate between the currency of the instrument and the base currency of the account. | |
MarketValue | double | The market value for the position. | |
MarketValueAccountCurrency | double | The market value for the position in the account currency. If instrument and account has the same currency this value is the same as MarketValue above. | |
MarketValueDisplayCurrency | double | The market value for the position according to display currency. | |
DisplayRate | double | The exchange rate between the position instrument currency and the DisplayCurrencyCode | |
AssetType | string | Type of asset | |
DisplayPercentagePrice | Bool | If price is in persentage of MinimumLotSize |
Code examples
C# - GetHistoricPositions
//Use the GetHistoricPositions
var client = new BFSServiceReference.bfsapiSoapClient();
var credentials = new BFSServiceReference.Credentials()
{
UserName = bfsusername, //Username of administrative user in your instance of BFS
Password = bfspassword, //Password of the administrative user in your instance of BFS
};
var positions = client.GetHistoricPositions(new BFSServiceReference.GetHistoricPositionRequest()
{
Credentials = credentials,
identify = bfsidentifier, //Identifier is a unique token for your instance of BFS
Args = new GetHistoricPositionArgs()
{
StartDate = new DateTime(2016, 04, 01, 0, 0, 0, DateTimeKind.Utc),
EndDate = new DateTime(2016, 04, 20, 0, 0, 0, DateTimeKind.Utc),
DisplayCurrencyCode = "USD",
AccountDimensionKey = "T",
Accounts = new[]
{
new Guid("40045f57-9914-41d2-9ffd-a33a59de10c9"),
}
},
Fields = new BFSServiceReference.GetHistoricPositionFields()
{
Account = true,
AccountNo = true,
AccountDimensionKey = true,
Amount = true,
Asset = true,
AssetType = true,
BalanceDate = true,
BaseRate = true,
DisplayCurrencyCode = true,
DisplayRate = true,
FxRate = true,
MarketValue = true,
MarketValueAccountCurrency = true,
MarketValueDisplayCurrency = true,
Price = true
},
});
foreach (var c in positions.Result)
{
Console.WriteLine(c.Account + ", "
+ c.AccountNo + ", "
+ c.AccountDimensionKey + ", "
+ c.Amount + ", "
+ c.Asset + ", "
+ c.AssetType + ", "
+ c.BalanceDate + ", "
+ c.BaseRate + ", "
+ c.DisplayCurrencyCode + ", " //
+ c.FxRate + ", "
+ c.MarketValue + ", "
+ c.MarketValueAccountCurrency + ", "
+ c.MarketValueDisplayCurrency + ", " //
+ c.Price + ", "
+ c.MarketValue);
}
XML - GetHistoricPositions example request
<?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:tns="http://tempuri.org/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<soap:Body>
<GetHistoricPositions xmlns="http://tempuri.org/">
<req>
<Credentials>
<UserName>{{username}}</UserName>
<Password>{{password}}</Password>
</Credentials>
<identify>{{identifier}}</identify>
<Args>
<Accounts>
<guid>[Guid of the account]</guid>
<guid>[Guid of the account]</guid>
</Accounts>
<StartDate>[The start date]</StartDate>
<EndDate>[The end date]</EndDate>
<AccountDimensionKey>[The account dimension T or S (Trade/Settle)]</AccountDimensionKey>
<DisplayCurrencyCode>[The currency code. For example USD]</DisplayCurrencyCode>
</Args>
<Fields>
<BrickId>true</BrickId>
<Asset>true</Asset>
<CreatedDate>true</CreatedDate>
<Account>true</Account>
<AccountNo>true</AccountNo>
<BalanceDate>true</BalanceDate>
<Amount>true</Amount>
<AccountDimensionKey>true</AccountDimensionKey>
<Price>true</Price>
<FxRate>true</FxRate>
<BaseRate>true</BaseRate>
<MarketValue>true</MarketValue>
<MarketValueAccountCurrency>true</MarketValueAccountCurrency>
<MarketValueDisplayCurrency>true</MarketValueDisplayCurrency>
<DisplayRate>true</DisplayRate>
<AssetType>true</AssetType>
<DisplayPercentagePrice>false</DisplayPercentagePrice>
<IncludeZeroes>true</IncludeZeroes>
</Fields>
</req>
</GetHistoricPositions>
</soap:Body>
</soap:Envelope>
Blog stream
Create a blog post to share news and announcements with your team and company.
Related pages
Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved