BNP Paribas
Long-Term Value-at-Risk (VaR)
- In C++ using Eclipse,
- Historical Risk (hence historical calibration),
- Projections:
- Equity : Black Scholes and Heston,
- Interest Rates : Vasicek, Hull and White, CIR, CIR++,
- Dependence of variables taken into account using copula (Gaussian, Student, Cook, Frank).
QuantCube Technology
Trading Strategy based on USDA Corn Quality Prediction
- USDA publishes weekly a report on Crop Quality in the different US states,
- This report contains, for each crop during its growing period, an estimate of its quality as a percentage of Very Poor, Poor, Fair and Good,
- Market reacts to these reports,
- We apply a simple trend following on the quality (if the quality raised during past weeks, predicts it will continue and vice versa),
- We only apply to Corn as it was the most impacted by this report (US production and export of Corn is high),
- Technology : Python (Web Scrapping to extract reports, data extraction from reports and prediction),
- Sharpe was 1.4 with 57% hit ratio but we could take just few positions in a year as the growing period of corn only last few months.
- Trained and Tested methodology on Kaggle Sea Lions Count Dataset,
- Goal of this Kaggle was to count the number of sea lions in aerial images + tell the category of the sea lion among male, female, child, newborn (same methodology could later be used to count cars of buildings),
- For this project we set up our own Computing Machine (with an Nvidia 1080 Ti),
- We used Python: Pytorch, OpenCV, Numpy, …,
- We used a modified version of the YOLO model: we modified the loss to add a sigmoid,
- We finish in the top 10% of the Kaggle competition.
ESA Satellite Images analysis
- ESA (European Space Agency) freely publish images of the Copernicus Sentinel mission (Sentinel-2 and other satellites),
- I start developing the infrastructure to read, download, reconstruct and analyse the images,
- Reconstruction was particularly tricky as it requires learning Military Grid Reference System and needed various angles corrections.
Société Générale
NLP for political risk
- The economists of the Bank track the risk of the countries where SG have or may have investment,
- Goal of the project was to give an indicator of political risk in different countries,
- Historical data source of data came from Factiva as well as live data,
- As we did not have labeling capacity (and that zero shot learning model were not available at the time) we used a mixed approach:
- Train a W2V model on 300K historical news,
- Create a word dictionary of positive and negative word (with the help of the economists),
- Augment this dictionary using the W2V representation of the words (for example expand the label to the 10 closest words - or with a decreasing weight of the label wrt to the distance of the initial word)
- This dictionary augmentation helped not having sparse result (ie lot of news with no label because it contains no word in the dictionary),
- Second benefice was that the economists could modified the base dictionary to add or remove words as well as the augmented dictionary.
Financial derivatives clustering
- Trading desk limits are set by product type,
- Each product is normally defined internally via a template (each product has its own template),
- However sometimes wrong templates are used and tricked to define a product + the products evolve during their life and they can change of category (for example an Autocall that hit its autocall barrier or a Lock-in that hit its lock-in barrier),
- The goal of the project was then to rediscover the categories of 20K products using their sensitives and risk metrics,
- Sensitives were the Greeks (Delta, Gamma, Vega, Theta) as well as shifted Greeks,
- Risk Metrics were mainly VaR for different levels (shifted?),
- We used some preprocessing methods (standardization, outlier detection, …),
- We used clustering methods (Hierarchical Clustering, DBSCAN, K-Means),
- Best results were obtained using the spectral (DBSCAN) method: the products families were clearly identifiable and some wrongly categorized product could be identified.
Auto-ML for unsupervised learning
- The Financial derivatives clustering led to a broader project of Auto-ML for unsupervised learning which take the form of a fork of the internal library AiKit,
- The difficulty of Auto-ML for unsupervised learning is the metrics to optimized and the similarity of the output of some methods: we used a mix of different unsupervised metrics to score the models and applied a similarity detection among models (more or less count the number of products that are equally clustered)
- Also it was important to respect the style and logic of the library and to test every part of the code,
- This library was later used for other clustering projects.
Intraday Liquidity Prediction
- Every days, the treasurers of the Bank make and receive interbank payments (example if I send from my SG account money to my BNP Paribas friend’s account, SG will send this money to BNP Paribas) as well as payments from other institution (especially Clearning Houses),
- They do this through interbank payment plateforms such as SWIFT,
- If the Bank make a lot of payments but do not receive payments in return, we have what we call a liquidity gap: the bank is short of liquidity,
- The treasurers can retain some payments (they generally do not retain too much the payments otherwise the counterparties will do the same and pay at the end of the day - everyone looses),
- They wanted some informations on the risk of having a liquidity gap during the day,
- We develop an time series analysis using RNN on the historical intraday balance of the bank (5 years of daily SWIFT orders),
- We cross this analysis with other information (market tension, view of the treasurers),
- We predict for every day the liquidity gap of the bank during the day: the prediction was updated live during the day (every 5mn) with new information,
- Using this information, treasurers could reduce the buffer from €10B to €8B,
- I did not work on the update of the model once it runs live: as the model impact the environment, retraining would require an non impacted environment ie ask the treasurers to label if a payments has been retained because of the model (and it still won’t be perfect as our payments impact our counterparties payments and we can’t know if they retain a payments because we did the same),
- Another solution would be to use RL: a model which interacts with the environment, each decision change the environment and each decision is taken given the current environment. Each day is an episode and the model can be updated live or at the end of each day.
Aviva Investors - OFI Invest
Pair Trading
- Pair Trading is a well known trading strategy: buy one stock and sell one stock and expect that the difference of performance between these 2 stocks generate a benefit (the stock buyed over perform compare to the one sold),
- Classic setting use decision rules to define pair trading opportunities,
- I used ML methods on historical times series to predict pair trades opportunities,
- Universe : Bond,
- Separate by: Region (Europe, US, Other), Maturity (<2Y, <5Y, <10Y, <15Y, >15Y), Rating (High Yield, Investment Grade),
- Test every couple in every cluster,
- Data was the spread of the Bonds,
- Data used was statistics on the time series: moments on spreads, moments on gap, difference between mean and current values, standardized difference between mean and current values, cointegration statistic Engle-Granger two-step cointegration test,
- Lot of computation time, used algorithmic optimisation to accelerate computation (mainly use dict rather than dataframe to make the computations),
- Backtest was also tricky because I had to respect temporality (train on older data and test on newer) but I also had to split training and test on pairs hence using unseen pairs on future data for testing,
- For validation I just split on pairs without checking temporality
Neural Network Calibration of Volatility Cube
- Everyday we calibrate volatility surface for interest rate, equity and FX,
- For IR products, we use Black formula to get Implied Volatility and then we use SABR model to smooth the smiles,
- SABR calibration is slow as it requires an optimisation of the parameters (a, r, rho - b=0.5): it computes the volatilities for different points for the current parameters and update these parameters wrt to the error to the implied vol,
- Idea was to make a direct mapping from the current implied volatility surface + forward rate to the parameters,
- Difficulty came from the generation of data to train the Neural Network model (Shallow Network)
For NN SABR calibration done on LIBOR curves (on 3 years of data filtered on maturity + tenor > 50Y), steps were:
- Retrieve Swaption Implied Volatilities:
- Get a Series with index as Valuation Date, Tenor, Expiry (Maturity), Strike with value being the implied volatility of the Swaption
- Retrieve SABR model parameters calibrated on these Swaption:
- Get a DataFrame with index as Valuation Date, Tenor, Expiry and values as SABR parameters:
- Each (Valuation Date x) Tenor x Expiry has its SABR parameters but these parameters are the same for the different Strikes
- Retrieve the Forward Swap Rates:
- We only store in Database the zero rate curves (LIBOR and OIS),
- We will use these zero rate curves to reverse engineer the bootstrapping method and extract the Forward Swap Rates:
- Using the LIBOR zero curve we deduct every forward rate that represents the floating leg expected coupons,
- Using the OIS zero curve we extract all the spot and forward DF,
- We can deduct the fair fix rate of the forward swaps (we use Quantlib)
- Get a Series with index as Valuation Date, Tenor, Expiry and values as the Forward Swap Rate
- Compute errors between implied volatility and SABR volatility
- Merge the Serie of Implied Volatility with DataFrame of SABR parameters and Series of Forward Rate (by Valuation Date)
- Some data will be duplicated (SABR parameters as they are the same for the different Strikes and Forward Rate as they are also the same for different Strikes)
- Reshape the obtained DataFrame to have as index the Valuation Date x the Tenor and Columns the Expiry x (Strikes + Strikes Error) and values are implied volatilities and errors (between implied vol and SABR vol)
- Generation of noisy data (the historical data is not sufficient to calibrate a NN model)
- For every Tenor (one tenor represents one volatility surface):
- Takes for each Valuation Data and Maturity:
- The 3 SABR parameters (\(\alpha\), \(v\), \(\rho\) - \(\beta\) is set to 0.5),
- The error between implied and SABR volatilities (9 Strikes hence 9 errors),
- The forward curve,
- We obtain a matrix of with N(Valuation Dates) rows and (3 + 9 + 1) * M(Maturity) columns,
- We want to compute the correlation among this variables:
- Preprocessing: apply log to the \(\alpha\) and then standardised every columns
- Compute the covariance (correlation) matrix (size (3 + 9 + 1)M * (3 + 9 + 1)M)
- Generate N samples using the gaussian distribution with mean 0 and covariance the obtained covariance matrix (using numpy random multivariate normal)
- Generate M SABR volatility smiles and add the errors to recreate implied volatilities smiles
- These M implied volatility smiles represent an implied volatility surfaces associated with M*3 generated parameters and M forward rate
- Get a matrix of N generated implied surface volatilities with the associated SABR parameters and forward rate
- Do this for every Tenor
- Train the model to predict the 3*M SABR parameters for a volatility surface:
- The model will predict the 3*M parameters of a SABR surface volatility using the surface implied volatility and forward Rates
- Y = 3*M SABR parameters,
- X = 9*M implied volatilities (for 9 Strikes and M Maturities) and M forward rates
- We do not specify the Tenor (surface volatility for each tenor will be predicted the same way)
- For new implied volatilities and forward rates, quickly predict the SABR parameters