Running FIA via the Web
🚀

Running FIA via the Web

Prerequisites

Install Python on your PC. FIA can use any version from 3.6 upwards.

Install the ‘requests’ and ‘cryptography’ libraries

Download the demo example with data

The example contains two Python files, fia_demo.py and fia.py.

fia_demo.py contains sample code to call FIA

fia.py contains helper functions to simplify calling the API.

The simplest way to get started is with an example.

#------------------------------------------------------------------------------
#
# File: nt_demo.py
#
# Description: Simple demo to show how to upload files, run FIA, and download 
# results.
#
#------------------------------------------------------------------------------

from fia import *

username = 'NT'
password = 'ff7#7U'

data = {
    "PortfolioFile"	                : "gringotts_p.csv",
    "BenchmarkFile"		              : "gringotts_b.csv",
    "SecurityFile"                  : "gringotts_s.csv",
    "YieldCurveFile"                : "gringotts_y.csv",
    "IndexFile"                     : "gringotts_i.csv",
    "batch_id"		                  : "1",
    "SovereignCurveDecomposition"   : "STB",
    "SecurityDateFormat"            : "%d/%m/%y",
    "PortfolioDateFormat"           : "%d/%m/%Y",
    "BenchmarkDateFormat"           : "%d/%m/%Y",
    "YieldCurveDateFormat"          : "%d-%b-%y",
    "IndexDateFormat"               : "%d/%m/%Y",
    "SummaryAttributionReport"      : "true",
    "InteractiveAttributionReport"  : "true",
    "CSVreport"                     : "true",
    "XLSreport"                     : "true",
    "ZipFile"	                      : "nt_demo.zip"
}

UploadFile (data['PortfolioFile'],    username, password)
UploadFile (data['BenchmarkFile'],    username, password)
UploadFile (data['IndexFile'],        username, password)
UploadFile (data['SecurityFile'],     username, password)
UploadFile (data['YieldCurveFile'],   username, password)

ListFiles(username, password)

job_id = RunJson (data, username, password)

while True:    
   if IsRunning (job_id, username, password) == 'Complete': 
       break  
   
DownloadFile(data['ZipFile'], username, password)

ListFiles(username, password)