Overview
RetailOrderInstructionService is a rest service used to create and manager orders for clients.
...
Code Block |
---|
"/login/{ssn}" Stream Login(string ssn); "/customerinfo/{ssn}" Stream CustomerInfo(string ssn); "/create/{ssn}" Stream Create(string ssn, CreateOrderInstructionRetailDmaRequest json); "/update/{ssn}" Stream Update(string ssn, UpdateOrderInstructionsRetailDmaRequest json); "/cancel/{ssn}" Stream Cancel(string ssn, CancelOrderInstructionRetailDmaRequest json); "/calculateorder/{ssn}" Stream CalculateOrder(string ssn, CalculateOrderRetailDmaRequest request); "/portfoliooverview/{ssn}" Stream GetPortfolioOverview(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.PortfolioOverviewRequest request); "/portfolioposition/{ssn}" Stream GetPortfolioPosition(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.PortfolioPositionRequest request); "/portfoliotransactions/{ssn}" Stream GetPortfolioTransactions(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.PortfolioTransactionsRequest request); "/accountbalance/{ssn}" Stream GetAccountBalance(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.AccountBalanceRequest request); "/searchorders/{ssn}" Stream SearchOrders(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.OrderSearchRequest request); "/searchtrades/{ssn}" Stream SearchTrades(string ssn, Kodi.Kodiak.OrderEntry.Retail.Contracts.TradeSearchRequest request); |
Prerequisites
What do we need from 5D?
5D Endpoints - Paths to
PerformanceService
andExternalQueryService
Authorization/user configuration - The identity of windows user needed to call those services. This user is specified in appSettings.config as RetailsCustomerUserId
Setup
The Kodi.Kodiak.OrderEntry.Retail.dll file needs to be present in C:/KodiakOrderEntryServer
A correct version of Kodi.Kodiak.Adapters.Libra.dll (above 3.1.1.52) needs to be present in C:/KodiakOrderEntryServer
Configuration
The following configuration files need to be set
1: config/environmentserviceconfig/appSettingsCustomServices.config
This file contains the depency injection cofiguration for the service.
Code Block | ||
---|---|---|
| ||
<object id="RetailOrderInstructionService" type="Kodi.Kodiak.Services.RetailOrderInstructionService, Kodi.Kodiak.OrderEntry.Retail" singleton="false" scope="request"> <property name="LibraExtSystemId" value="Libra"/> <property name="DefaultUserIdForRetailCustomers" value="${RetailCustomersUserId}"/> <property name="UserRepository" ref="UserRepository"/> <property name="CustomerRepository" ref="CustomerRepository"/> <property name="RetailKodiakService" ref="RetailKodiakService"/> <property name="RetailOrderInstructionEntryService" ref="RetailOrderInstructionEntryService"/> <property name="RetailSearchService" ref="RetailSearchService"/> <property name="PortfolioService" ref="PortfolioServiceImplementation"/> <property name="AccountService" ref="AccountServiceImplementation"/> </object> |
2: config/serviceconfig/system.servicemodel.services.config
This setting needs to be added here for the Wcf system to load the service.
Code Block | ||
---|---|---|
| ||
<!-- For use with Retail CustomersDMA --> <add key="RetailCustomersUserId" value="68" /> <add key="RetailCustomersAllocateWhenFilled" value="true" /> <add key="RetailCustomersDirectToMarket" value="true" /> <add key="RetailCustomersBypassBackoffice" value="true" /> |
...
<service behaviorConfiguration="ServiceBehaviorBasic" name="RetailOrderInstructionService">
<endpoint address="" binding="webHttpBinding" contract="Kodi.Kodiak.Services.IRetailOrderInstructionService" behaviorConfiguration="rest" />
</service> |
3: Config/Spring/Kodi.Kodiak.OrderEntry.Retail.config
This file contains configuartion for RetailKodiakService, RetailOrderInstructionService and RetailSearchService
Code Block | ||
---|---|---|
| ||
<object id="RetailKodiakService" type="Kodi.Kodiak.OrderEntry.Retail.RetailKodiakService, Kodi.Kodiak.OrderEntry.Retail">
<property name="CustomerRepository" ref="CustomerRepository"/>
<property name="LoginRepository" ref="LoginRepository"/>
<property name="OrderInstructionRepository" ref="OrderInstructionRepository"/>
</object>
<object id="RetailOrderInstructionEntryService" type="Kodi.Kodiak.OrderEntry.Retail.RetailOrderInstructionEntryService, Kodi.Kodiak.OrderEntry.Retail">
<property name="AllocateWhenFilled" value="${RetailCustomersAllocateWhenFilled}"/>
<property name="DirectToMarket" value="${RetailCustomersDirectToMarket}"/>
<property name="BypassBackoffice" value="${RetailCustomersBypassBackoffice}"/>
<property name="CustomerRepository" ref="CustomerRepository"/>
<property name="BrokerRepository" ref="BrokerRepository"/>
<property name="OrderInstructionRepository" ref="OrderInstructionRepository"/>
<property name="InstrumentRepository" ref="InstrumentRepository"/>
<property name="OrderValidationAdapter" ref="OrderValidationAdapterRetail"/>
<property name="OrderCalculator" ref="OrderCalculator"/>
<property name="OrderInstructionEntry" ref="OrderInstructionEntry"/>
<property name="OrderService" ref="OrderService"/>
</object>
<object id="RetailSearchService" type="Kodi.Kodiak.OrderEntry.Retail.RetailSearchService, Kodi.Kodiak.OrderEntry.Retail">
<property name="OrderInstructionRepository" ref="OrderInstructionRepository"/>
<property name="TradeRepository" ref="TradeRepository"/>
<property name="CustomerRepository" ref="CustomerRepository"/>
<property name="PortfolioRepository" ref="PortfolioRepository"/>
</object> |
4: Kodi.Kodiak.WindowsServices.OrderEntryServer.exe.config
...
Code Block | ||
---|---|---|
| ||
<resource uri="~/Config/Spring/Kodi.Kodiak.OrderEntry.Retail.config" /> |
35: Config/config/Adapters.config
The OrderValidationAdapterRetail needs to be configured. OrderValidationAdapterRetail uses PortfolioServiceImplementationand AccountServiceImplementation which are defined in Spring/Kodi.Kodiak.Allocations.config. Those nodes use PortfolioPositionAdapter and AccountBalanceAdapter are also configured in Adapters.config.
Code Block | ||
---|---|---|
| ||
<object id="OrderValidationAdapterRetail" type="Kodi.Kodiak.OrderEntry.Retail.OrderValidationAdapter, Kodi.Kodiak.OrderEntry.Retail |
...
This file contains configuartion for RetailKodiakService, RetailOrderInstructionService and RetailSearchService
...
">
<property name="OrderInstructionRepository" ref="OrderInstructionRepository"/>
<property name="PortfolioService" ref="PortfolioServiceImplementation"/>
<property name="AccountService" ref="AccountServiceImplementation"/>
<property name="OrderCalculator" ref="OrderCalculator"/>
</object>
<object id="PortfolioPositionAdapter" type="Kodi.Kodiak.Adapters.Libra.PortfolioPositionAdapter, Kodi.Kodiak.Adapters.Libra">
<property name="OrderInstructionRepository" ref="OrderInstructionRepository" />
<property name="PortfolioRepository" ref="PortfolioRepository" />
<property name="CustomerRepository" ref="CustomerRepository" />
<property name="InstrumentRepository" ref="InstrumentRepository" />
<property name="AllocationSummaryService" ref="AllocationSummaryService" />
<property name="OrderInstructionSummaryService" ref="OrderInstructionSummaryService" />
<property name="LibraInterface" ref="LibraInterface" />
<property name="CalculateAveragePriceFromTransactions" value="false" />
</object>
<object id="AccountBalanceAdapter" type="Kodi.Kodiak.Adapters.Libra.AccountBalanceAdapter, Kodi.Kodiak.Adapters.Libra">
<property name="OrderInstructionRepository" ref="OrderInstructionRepository" />
<property name="PortfolioRepository" ref="PortfolioRepository" />
<property name="CustomerRepository" ref="CustomerRepository" />
<property name="OrderInstructionSummaryService" ref="OrderInstructionSummaryService" />
</object>
|
6: config/environment/appSettings.config
An important setting here is RetailCustomerUserId which maps to the user which will be used when creating orders and calling libra services.
Code Block | ||
---|---|---|
| ||
<!-- For use with Retail DMACustomers --> <service <add behaviorConfigurationkey="ServiceBehaviorBasicRetailCustomersUserId" namevalue="RetailOrderInstructionService68" /> <endpoint<add addresskey="RetailCustomersAllocateWhenFilled" bindingvalue="webHttpBinding" contract="Kodi.Kodiak.Services.IRetailOrderInstructionService" behaviorConfiguration="resttrue" /> <add key="RetailCustomersDirectToMarket" value="true" /> </service> |
...
<add key="RetailCustomersBypassBackoffice" value="true" /> |
7: config/serviceconfig/system.servicemodel.client.config
This file contains the web service client configuration used to call Libra services.
Code Block | ||
---|---|---|
| ||
<endpoint address="http://urltolibraserver/Libra.Services/Assetmanager/PerformanceService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPerformanceService" contract="LibraServices.IPerformanceService" name="WSHttpBinding_IPerformanceService"> <!-- <identity> --> <!-- <userPrincipalName value="srv.iisapppool_test@fjaf.internal" /> --> <!-- </identity> --> </endpoint> <endpoint address="http://urltolibraserver/Libra.Services/Portfolio/ExternalQueryService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IExternalQueryService" contract="LibraServicesExternal.IExternalQueryService" name="WSHttpBinding_IExternalQueryService"> <!-- <identity> --> <!-- <userPrincipalName value="srv.iisapppool_test@fjaf.internal" /> --> <!-- </identity> --> </endpoint> |
68: config/serviceconfig/CustomServices.configsystem.servicemodel.bindings.config
The client config in section 7 need wsHttpBindings.
Code Block | ||
---|---|---|
| ||
<object id <binding name="RetailOrderInstructionService" type="Kodi.Kodiak.Services.RetailOrderInstructionService, Kodi.Kodiak.OrderEntry.Retail" singleton="false" scope="request"> <property name="LibraExtSystemId" value="Libra"/> <property name="DefaultUserIdForRetailCustomers" value="${RetailCustomersUserId}"/> <property name="UserRepository" ref="UserRepository"/> <property name="CustomerRepository" ref="CustomerRepository"/> <property name="RetailKodiakService" ref="RetailKodiakService"/> <property name="RetailOrderInstructionEntryService" ref="RetailOrderInstructionEntryService"/> <property name="RetailSearchService" ref="RetailSearchService"/> <property name="PortfolioService" ref="PortfolioServiceImplementation"/> <property name="AccountService" ref="AccountServiceImplementation"/> </object> WSHttpBinding_IPerformanceService" textEncoding="utf-8" maxReceivedMessageSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000" /> </binding> <binding name="WSHttpBinding_IExternalQueryService" textEncoding="utf-8" maxReceivedMessageSize="20000000"> <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000" /> </binding> |