GetHistoricPositions

Filter inputs

NameTypeDescriptionMandatoryAvailable from version
StartDateDateTimeFilter by start date True
EndDateDateTimeFilter by end dateTrue
DisplayCurrencyCodestringEnter what currency in ISO-format that the results should be retreived inTrue
AccountDimensionKeystringFilter by dimension key ("T" for traded, "S" for settled)True
AccountsGuid[]?Filter by BfsId of accounts

AssetsGuid[]?Filter by BfsId of assets

IncludeZeroesboolIf set to yes, empty and negative positions will be included. Defaultvalue is false if not supplied
2.20
AssetTypeKeysstring[]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

NameTypeDescriptionAvailable from version

Account

GuidBfsId of the account
AccountNostringThe account number for the position
AssetGuidBfsId of the instrument
BalanceDateDateTimeThe balance date of the position
AmountdecimalThe amount of the position
AccountDimensionKeystringThe dimension of the positon, "T" for traded and "S" for settled

Price

doublePrice of instrument when position was acquired.
FxRatedoubleThis 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
BaseRatedoubleThis is the exchange rate between the currency of the instrument and the base currency of the account.

MarketValue

doubleThe market value for the position.
MarketValueAccountCurrencydoubleThe 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.
MarketValueDisplayCurrencydoubleThe market value for the position according to display currency.

DisplayRate

doubleThe exchange rate between the position instrument currency and the DisplayCurrencyCode
AssetTypestringType of asset
DisplayPercentagePriceBoolIf 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);
}

Blog stream

Create a blog post to share news and announcements with your team and company.