FinLab – a trading platform for Facebook
A Forex simulator application for Facebook. Best players receive cache prizes.
Objective:
- Creation of a Forex platform from scratch
- Optimization for high volume traffic and uninterrupted operation
- Implementation in the form of a Facebook app
Project overview
One of the most technically complex and challenging projects that we have worked on
- Dev. capacity 4000 hours spent
- Duration 6 months
- Dev. team 7 people
- Designed and styled to look like a professional trading platform, no excess
- Integrated within Facebook. In app purchasing: services, analytics, financial newsfeed, souvenirs
- Integration of a high-speed feed of actual market data
- Detailed documentation throughout the development process, including API communication between client and server sides, detailed instructions for server administration.
Project Specifics
Production approach
The project was developed as a single page application on the basis of the Backbone.js library.
Custom API
A resilient API was written and well documented along with a sandbox (for testing API methods) to facilitate communication of the client side with the server side.
Caching
The application is multilingual, each languages JS code is compiled in modules that are placed into one file that in turn caches with each client. This approach increases download speeds for returning visitors.
Graphs
A custom library was written to satisfy the client’s’ need for a financial chart builder.
Multi-stream incoming quotes
Establish a connection to a high-speed feed of financial data. For the most effective use of the servers’ resources a multi-stream script for data processing with caching has been written on Python.
In order to output the data for each time frame a separate stream is created through the web socket, so every new visitor is connected to one of these existing channels instead of creating a new one.
Databases
Two databases: PostgreSQL and MongoDB. Most of the financial logic is processed as procedures in the PostgreSQL server. All procedures were tested in unit testing. MongoDB is used as a storage server of activity, analysis and statistical data of every user’s activity.
Data output for clients
Data exchange between the client and the server is carried out through the web-socket, as it is the most productive method of working with constant data streams.
Back-end framework
The back-end is embodied on an MVC framework – Symfony2.
Load testing
Load testing was carried out with the help of Jmeter. Performance and bottlenecks were checked and identified with NewRelic.
Auto-testing
The whole project was covered by Behat auto tests. Selenium was used for the client-side.
Scaling
Automatic scalability was implemented; the project was divided into modules to ensure the capability of placing high volume modules into different servers. The process of scaling is designed to run autonomously, PAAS Jelastic is used for both vertical and horizontal scaling.
Technologies
- PHP Python
- require.js
- Symfony2
- Backbone.js
- Sockets: redchet.php, autobahn.js
- Queues: ZNQ
- Testing: phpunit, behat/mink, selenium
- Load testing: jmeter
- Monitoring ofperformance: new relic
- Postgresql, Mongodb
- PAAS Jelastic