This repository was archived by the owner on Jun 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexample.cpp
More file actions
42 lines (27 loc) · 1.26 KB
/
example.cpp
File metadata and controls
42 lines (27 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//=================================================================================================
// Copyright (C) 2017 Olivier Mallet - All Rights Reserved
//=================================================================================================
#include "Headers/QuotesDB.hpp"
#include "Headers/Config.hpp"
int main()
{
// creating a connection to Oanda server
qdb::OandaAPI conn("practice");
// downloading data from the 1st of Janurary 2007 and recording them in QuotesDB database
conn.initAllTabs(DATABASE_NAME,"2007-01-01 00:00:00");
// it will then download data for every pair (INSTRUMENT,GRANULARITY) defined in QuotesDB.hpp
// you can the update later the database by simply doing:
//conn.updateAllTabs("QuotesDB");
//conn.updateTab("QuotesDB", "EUR_USD", "M1");
// connecting to QuotesDB database for reading data
//std::cout << conn.getInstruments() << '\n';
//qdb::DataBase db(DATABASE);
// qdb::Bar b = db.get_last_row("EUR_USD_D");
// printf("%d\n", b.date );
// reading the last 10 recorded Bars from table EUR_USD_D
//std::vector<qdb::Bar> data = db.read_table("EUR_USD_M1",10);
// outputting the data
// for (int i = 0; i < data.size(); ++i) {
// data[i].print();
// }
}