Home > User Guide > Loading Data > Automated Loading

Automated Loading

Introduction

There are two ways loads can be automated. The load web services can be called directly by your source system, or a zipped file with csv or xml data can be sent to a URL. Both of these approaches are described below.


Web Service Direct Call

The Vector Risk workflow includes a web service for each of the load types (trades, rates, evolution parameters, counterparties, default risk, daily P&L, FRTB SA sensitivities, FRTB IMA VaR vectors). These services can be consumed in the standard way, by using "wsdl" to generate references that are then included in your interfacing code. Because the product definitions use an argument list of name/value pairs, new products can be added to the system without invalidating these services. This makes the direct web service call a viable long term approach to loading data in production to the Vector Risk service.


Bulk File Load

Both CSV and XML format files can be bulk loaded in zip format. To do this you access the ASHX web handler service:
https://username:password@workflow.vectorrisk.com/dailyprocess.ashx


The benefits of this approach are:

This process can be automated, and a script follows to give an example of this automation. This script uses the Ruby gems scripting language but other languages could be used. This code or similar can be embedded in your daily process in order to automate the bulk load process.

Note: Single csv or xml files can also be loaded this way, and do not need to be zipped; the zip file performs the secondary purpose of grouping several files together when a group of files is to be loaded together.


Once only installation of ruby gems:


Download and install rubygems.

Run the following commands at a command prompt:

gem install rest-client
irb -rubygems


Script to be run daily:

#!/usr/bin/env ruby

require 'rubygems'
require 'rest_client'

# usage: ruby -w load_wf_csv.rb 'C:\Load Files\mydata.zip'

# these are configuration variables
@user = "MyOrg.Admin"
@pass = "MyPassword"
@domain = "workflow.vectorrisk.com"
@path = "dailyprocess.ashx"

@org = "MyOrg"
@env = "Test"

# dont change below
@url = "https://#@user:#@pass@#@domain/#@path"
@fpath = ARGV[0]

puts "Loading to #@url #@org.#@env"

RestClient.post(@url,
  :q => 'bulkload', # only loading csv for now. could be 'bulkload' for xml
  :e => "#@org.#@env",
  :datafile => File.new(@fpath, "rb")
  )


Note: The technical reference includes further information on this topic in the section Workflow Automation.



See also
Loading CSV data
Loading XML data