Creating business transactions

Almost any business event can be accomplished in BFS with the use of CreateBusinessTransactions via the BFS API. Before using this method it is very important to understand all the implications since it is possible to override the native functionality of BFS through this usage.

We will go more in depth on this topic in future installments of this blog but here we will explore a simple deposit of cash event.

There are two main account worlds in BFS, one is called BFS-accounts and the other is called Custody Accounts. When using BFS with a securities firm or an insurance company as the house it is only the house that should be the owner of any Custody Accounts and the account type is called HouseCustodyAccount in BFS.

The BFS-accounts keep track of the assets that users have in BFS while the Custody Accounts keep track of where the assets are in the outside world. The Custody Accounts should reflect actual holdings that the house has with external institutions.

For this example this means that a deposit made to a customer BFS-account of 100 SEK should also be accompanied by a deposit into a Custody Account like a client asset account held at a bank.

Each asset kept in a BFS-account should be backed up by a matching asset in a Custody Account.

In this example we are going to create a deposit of 100 SEK into an account for our test customer John Doe and we are also going to conduct a deposit into our client assets Custody Account with our bank to reflect that balance.

To work with this method it is also important to understand the structure of the BFS transaction types which will be discussed further in future articles. 

Our default transaction types for transferring cash are the following:

NameDescription
Default_Transfer_Trade_Cash

Default means that it is a default transaction type carried by BFS and not a custom transaction type configured by the user

Transfer means that it is a transaction of the type Transfer, the three main types of transactions in BFS are Transfer, Trade and Payment. Transfers typically contain only one asset while a Trade usually contains two assets

Trade means the balance dimension that will be affected by the transaction, the main balance dimensions in BFS are Trade and Settle

Cash means that the transaction type is used for transferring cash and in the BFS transaction mapping files this means that the transaction will only have a configuration for one asset which is called Asset1. If an instrument other than cash is involved it will be Asset2. Also to be explained further in the future.

Default_Transfer_Settle_Cash

Default means that it is a default transaction type carried by BFS and not a custom transaction type configured by the user

Transfer means that it is a transaction of the type Transfer, the three main types of transactions in BFS are Transfer, Trade and Payment. Transfers typically contain only one asset while a Trade usually contains two assets

Settle means the balance dimension that will be affected by the transaction, the main balance dimensions in BFS are Trade and Settle

Cash means that the transaction type is used for transferring cash and in the BFS transaction mapping files this means that the transaction will only have a configuration for one asset which is called Asset1. If an instrument other than cash is involved it will be Asset2. Also to be explained further in the future.

C# - Create business transactions
//Create a business event for a deposit with four business transactions using the CreateBusinessTransaction method
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 response = client.CreateBusinessTransactions(new BFSServiceReference.CreateBusinessTransactionRequest()
{
    Credentials = credentials,

    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS        

    Entities = new[]
    {
        new SuperTransaction()
        {
            BusinessTransactions = new BusinessTransaction[]
            {
                //Transaction for customer BFS-account
              new BusinessTransaction()
              {
                  Account = new Guid("cbfe4a0d-bf05-4a7e-bdc8-1ee809817bee"),
                  BusinessTransactionType = "Default_Transfer_Trade_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Trade dimension as suggested by the transaction name 
                  TradeDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for customer BFS-account
              new BusinessTransaction()
              {
                  Account = new Guid("cbfe4a0d-bf05-4a7e-bdc8-1ee809817bee"),
                  BusinessTransactionType = "Default_Transfer_Settle_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Settle dimension as suggested by the transaction name 
                  SettlementDate = DateTime.Parse("2016-04-18"),
                  ValueDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for house Custody account
              new BusinessTransaction()
              {
                  Account = new Guid("25c7b534-c2b6-47a9-a3df-1dcc88b1f49c"),
                  BusinessTransactionType = "Default_Transfer_Trade_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Trade dimension as suggested by the transaction name 
                  TradeDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for house Custody account
              new BusinessTransaction()
              {
                  Account = new Guid("25c7b534-c2b6-47a9-a3df-1dcc88b1f49c"),
                  BusinessTransactionType = "Default_Transfer_Settle_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Settle dimension as suggested by the transaction name 
                  SettlementDate = DateTime.Parse("2016-04-18"),
                  ValueDate = DateTime.Parse("2016-04-18")
              },
            },
        },                    
    }

});

foreach (var c in response.Entities)
{
    Console.WriteLine(c.BrickId + ", " + c.TransactionReference);
}

We have used the Asset ID of SEK and we retrieved the BrickId by using GetCash with the following code as well as the BrickId of the default Custody Account to use:

C# - GetCash
//Use the GetCash method to retreive information about the asset class cash
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 cash = client.GetCash(new BFSServiceReference.GetCashRequest()
{
    Credentials = credentials,

    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS 

    Args = new GetCashArgs()
    {
        Keys = new[]
        {
            "SEK"
        }
    },

    Fields = new BFSServiceReference.GetCashFields()
    {
        BrickId = true,
        Name = true,
        Currency = true,
        DefaultCustodyAccount = true,
        DecimalPlaces = true,
        InstrumentStatus = true
    },

});

foreach (var c in cash.Result)
{
    Console.WriteLine(c.BrickId + ";" + c.Name + ";" + c.Currency + ";" + c.DefaultCustodyAccount + ";" + c.DecimalPlaces);
}

In the GUI we can see the following for the customer:

And for the Custody Account the following is shown:

 

Terms of License
Change Policy
© 2009 - 2024 Huddlestock Technologies AB All rights reserved