trader  v0.1a
A framework to build trading applications
cryptowatchapi.h
1 
2 #pragma once
3 #include "app.h"
4 #include "api.h"
5 #include "helper.h"
6 
7 
8 namespace trader {
9 
10  namespace CryptowatchApi {
11 
12  class Allowance : public Poco::RefCountedObject {
13  public:
14 
15  Allowance();
16 
17  ~Allowance();
18 
19  void readFile(const std::string& _fileName);
20 
21  void read(Poco::Dynamic::Var val);
22 
23  struct DataObject {
24 
25  void SetCost(Poco::Int64 val)
26  {
27  cost = val;
28  }
29 
30  bool isSetCost() {
31  return (cost != std::numeric_limits<Poco::Int64>::max());
32  }
33 
34  Poco::Int64 cost;
35 
36  void SetRemaining(Poco::Int64 val)
37  {
38  remaining = val;
39  }
40 
41  bool isSetRemaining() {
42  return (remaining != std::numeric_limits<Poco::Int64>::max());
43  }
44 
45  Poco::Int64 remaining;
46 
47  DataObject()
48  : cost(std::numeric_limits<Poco::Int64>::max())
49  , remaining(std::numeric_limits<Poco::Int64>::max())
50  {
51  }
52 
53  };
54 
55  DataObject dataObject;
56  }; //Allowance
57 
58  class AllowanceIntrospector : public Poco::RefCountedObject {
59  public:
60 
62 
64 
65  void readFile(const std::string& _fileName);
66 
67  void read(Poco::Dynamic::Var val);
68 
69  struct DataObject {
70 
71  struct AllowanceObject {
72 
73  void SetCost(Poco::Int64 val)
74  {
75  cost = val;
76  }
77 
78  bool isSetCost() {
79  return (cost != std::numeric_limits<Poco::Int64>::max());
80  }
81 
82  Poco::Int64 cost;
83 
84  void SetRemaining(Poco::Int64 val)
85  {
86  remaining = val;
87  }
88 
89  bool isSetRemaining() {
90  return (remaining != std::numeric_limits<Poco::Int64>::max());
91  }
92 
93  Poco::Int64 remaining;
94 
96  : cost(std::numeric_limits<Poco::Int64>::max())
97  , remaining(std::numeric_limits<Poco::Int64>::max())
98  {
99  }
100 
101  };
102 
103  AllowanceObject allowanceObject;
104  DataObject()
105  {
106  }
107 
108  };
109 
110  DataObject dataObject;
111  }; //AllowanceIntrospector
112 
113  class AssetList : public Poco::RefCountedObject {
114  public:
115 
116  AssetList();
117 
118  ~AssetList();
119 
120  void readFile(const std::string& _fileName);
121 
122  void read(Poco::Dynamic::Var val);
123 
124  struct DataObject {
125 
126  struct ResultArray {
127 
128  void SetFiat(bool val)
129  {
130  fiat = val;
131  fiatSet = true;
132  }
133 
134  bool isSetFiat() {
135  return (fiatSet != false);
136  }
137 
138  bool fiat;
139  bool fiatSet;
140 
141  void SetId(std::string val)
142  {
143  id = val;
144  }
145 
146  bool isSetId() {
147  return (id != "Empty");
148  }
149 
150  std::string id;
151 
152  void SetName(std::string val)
153  {
154  name = val;
155  }
156 
157  bool isSetName() {
158  return (name != "Empty");
159  }
160 
161  std::string name;
162 
163  void SetRoute(std::string val)
164  {
165  route = val;
166  }
167 
168  bool isSetRoute() {
169  return (route != "Empty");
170  }
171 
172  std::string route;
173 
174  ResultArray()
175  : fiat(false)
176  , fiatSet(false)
177  , id("Empty")
178  , name("Empty")
179  , route("Empty")
180  {
181  }
182 
183  };
184 
185  typedef std::vector<ResultArray> Result;
186  Result result;
187  DataObject()
188  {
189  }
190 
191  };
192 
193  DataObject dataObject;
194  }; //AssetList
195 
196  class EndPoints {
197  public:
198 
199  EndPoints(Poco::AutoPtr<trader::App> app, Api* api);
200 
201  ~EndPoints();
202 
203 
204  // Returns all assets (in no particular order).
205  Poco::AutoPtr<AssetList> GetAssetList();
206 
207  // Get remaining rest call allowance
208  Poco::AutoPtr<Allowance> GetAllowance();
209 
210  Poco::AutoPtr<trader::App> _app;
211  Api* _api;
212  std::string _uri;
213  }; //EndPoints
214 
215  } //CryptowatchApi
216 } //trader
Definition: cryptowatchapi.h:12
Definition: cryptowatchapi.h:124
Definition: cryptowatchapi.h:58
Definition: cryptowatchapi.h:196
Definition: api.h:15
Definition: cryptowatchapi.h:23
Definition: app.h:7
Definition: cryptowatchapi.h:113