1#!/usr/bin/env python
2# -*- coding: utf-8; py-indent-offset:4 -*-
3###############################################################################
4#
5# Copyright (C) 2015, 2016, 2017 Daniel Rodriguez
6# Copyright (C) 2017 Dimitri John Ledkov
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20#
21###############################################################################
22from __future__ import (absolute_import, division, print_function,
23                        unicode_literals)
24
25
26from . import GenericCSVData
27
28
29class MT4CSVData(GenericCSVData):
30    '''
31    Parses a `Metatrader4 <https://www.metaquotes.net/en/metatrader4>`_ History
32    center CSV exported file.
33
34    Specific parameters (or specific meaning):
35
36      - ``dataname``: The filename to parse or a file-like object
37
38      - Uses GenericCSVData and simply modifies the params
39    '''
40
41    params = (
42        ('dtformat', '%Y.%m.%d'),
43        ('tmformat', '%H:%M'),
44        ('datetime', 0),
45        ('time',  1),
46        ('open',  2),
47        ('high',  3),
48        ('low',   4),
49        ('close', 5),
50        ('volume', 6),
51        ('openinterest', -1),
52    )
53