Git Product home page Git Product logo

hsbc's Introduction

README

The Package

You will likely have executed a git clone on this package from https://github.com/paulyd82/HSBC/tree/main. Some assumptions for this project:

  • The user is on a Linux server with q installed.
  • The package, once cloned, may be named "HSBC-main". Please rename it to HSBC
mv HSBC-main HSBC
  • The repository has been cloned into the home/root directory of your user/appuser. Files are loaded based on this location i.e. sourced from ~/HSBC/... If the package does not reside here then please move it to the ~/ directory.
mv HSBC ~/.

Start-up

Start q process for Tasks 1 and 2

Once the package is ready in the correct location you can then run the following command to start the q process. On start-up it automatically loads the CSV files and q functions from the package:

q ~/HSBC/q/vwap_funcs.q

Successful start-up should be illustrated with the following example messages logged to your q session (note the counts may differ, but should be > 0):

"Loading CSV file ~/HSBC/data/fx_data.csv"
"CSV file successfully loaded. Count 150"
"Loading CSV file ~/HSBC/data/clientorders_data.csv"
"CSV file successfully loaded. Count 75"
"Loading CSV file ~/HSBC/data/markettrades_data.csv"
"CSV file successfully loaded. Count 50"

Upon loading, the 3 tables associated with these tasks should subsequently be available for inspection as part of assessment:

select from fx
select from clientorders
select from markettrades

The function to load the CSVs is error trapped and the logged error should be intuitively handled by the user.

Task 1 Execution

VWAP

  • Function call format:
calcVWAP[fx;s;st;et]

// fx: the name of the pre-loaded table from csv
// s: sym or list of syms
// st: start time
// et: end time
  • Example call:
calcVWAP[fx;`USDEUR;11:30:00;12:00:00]
calcVWAP[fx;`CADUSD`SGDUSD;11:00:00;12:00:00]

// inspect table fx for appropriate sym and time range parameters for any other calls
  • Returns a 2 column table of sym and VWAP values
  • Catches and prints error if encountered

TWAP

  • Function call format:
calcTWAP[fx;s;st;et]

// fx: the name of the pre-loaded table from csv
// s: sym or list of syms
// st: start time
// et: end time
  • Example call:
calcTWAP[fx;`USDEUR;11:30:00;12:00:00]
calcTWAP[fx;`CADUSD`SGDUSD;11:00:00;12:00:00]

// inspect table fx for appropriate sym and time range parameters for any other calls
  • Returns a 2 column table of sym and TWAP values
  • Catches and prints error if encountered

Task 2 Execution

Conditional VWAP

  • Function call format:
calcCondVWAP[clientorders;markettrades]

// clientorders:  the name of the pre-loaded table from csv
// markettrades:  the name of the pre-loaded table from csv
  • Example call:
calcCondVWAP[clientorders;markettrades]
  • Returns a 4 column table of sym, start, end and condVWAP values
  • Catches and prints error if encountered

Unit Tests

Starting The q Process

Start up the q process and load in the unit testing script:

q ~/HSBC/unitTests/k4unit.q

Run the following to load in the tests:

KUltf `$":~/HSBC/unitTests/tests.csv"

Run the following to inspect the tests:

KUT

To execute the tests, run following:

KUrt[]

To inspect results:

KUTR

// or some other examples:
show select from KUTR where not ok
show select from KUTR where not okms
show select count i by ok,okms,action from KUTR
show select count i by ok,okms,action,file from KUTR

Running the following saves the table KUtr to a file KUTR.csv:

KUstr[] 

hsbc's People

Contributors

paulyd82 avatar eohara-ie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.