/
Bitmaszyna.cpp
690 lines (628 loc) · 19.9 KB
/
Bitmaszyna.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
/*
* Copyright (c) 2015 Damian Obernikowicz <damin.obernikowicz@gmail.com>, BitMarket Limited Global Gateway 8, Rue de la Perle, Providence, Mahe, Seszele
*
* This file is part of Bitkom.
*
* Bitkom is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bitkom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Bitkom. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "Bitmaszyna.h"
#include "util.h"
#include "basedata.h"
const string Bitmaszyna::strMessageMagic="Bitmaszyna.pl API:\n";
extern void log(string s);
extern BaseData *base;
#define BITMASZYNAURL "https://bitmaszyna.pl/api/"
//#define BITMASZYNAURL "https://192.168.1.100:10443/api/"
#ifdef IPHONE
void BN_zero_ex(BIGNUM *)
{
}
#endif
Bitmaszyna::Bitmaszyna() {
bb=false;
chunk.memory = (char *)malloc(1);
chunk.size = 0;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_URL, BITMASZYNAURL);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, TIMEOUT);
name="Bitmaszyna";
logged=false;
id=BITMASZYNA;
profit=0;
profitPercentage=0;
value=0;
currentTables=new Tables();
Currency c;
c.name="PLN";
c.type=PLN;
c.deposit=true;
currencies.push_back(c);
c.name="BTC";
c.type=BTC;
c.deposit=true;
currencies.push_back(c);
c.name="LTC";
c.type=LTC;
c.deposit=true;
currencies.push_back(c);
c.name="DOGE";
c.type=DOGE;
c.deposit=true;
currencies.push_back(c);
c.name="LSK";
c.type=LSK;
c.deposit=true;
currencies.push_back(c);
c.name="KBM";
c.type=KBM;
c.deposit=false;
currencies.push_back(c);
key="";
secret="";
withdrawalcurrency=BTC;
}
string Bitmaszyna::sign(string& privkey,string& msg) {
v=DecodeBase64(privkey.c_str(),&bb);
if (bb)
{
lasterror="Invalid secret";
logerror();
return("");
}else if (v.size()!=32)
{
lasterror="Secret too short";
logerror();
return("");
}
ckey.SetSecret(v);
SHA256_Init(&ctx);
SHA256_Update(&ctx,strMessageMagic.c_str(),strMessageMagic.size());
SHA256_Update(&ctx,msg.c_str(),msg.size());
SHA256_Final((unsigned char *)&hash1,&ctx);
SHA256((unsigned char *)&hash1,sizeof(hash1),(unsigned char *)&hash2);
if (!ckey.SignCompact(hash2, vsig)) {
lasterror="Sign failed";
logerror();
return("");
}
signature=base64_encode(&vsig[0],vsig.size());
return(signature);
}
int Bitmaszyna::api(string post,string method)
{
struct curl_slist *headers=NULL;
string privkey,hed;
stringstream ss;
chunk.size=0;
privkey=secret;
curl_easy_setopt(curl, CURLOPT_POST,1);
curl_easy_setopt(curl, CURLOPT_URL, (BITMASZYNAURL+method).c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post.c_str());
hed=string("Rest-Key: ")+key;
headers = curl_slist_append(headers, hed.c_str());
hed=string("Rest-Sign: ")+sign(privkey,post);
headers = curl_slist_append(headers, hed.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_perform(curl);
if (chunk.size<=0) printf("Error connecting to bitmaszyna.pl %s\n",(BITMASZYNAURL+method).c_str());
//else log(string(chunk.memory)+"\n");
curl_slist_free_all(headers);
//log(":::"+to_string(chunk.size)+"\n");
return(chunk.size);
}
bool Bitmaszyna::makeApiCall(string method,struct json_object **json,string post)
{
log(method+": "+post+"\n");
if (api(post,method)>0) {
if ((long)(*json=json_tokener_parse(chunk.memory))==0)
{
lasterror="Not a json file";
logerror();
log(string(chunk.memory)+"\n");
return(false);
}
#ifdef DEBUG
log(string(chunk.memory)+"\n");
#endif
return(true);
}
else {
lasterror=name+" "+method+": "+curl_easy_strerror(curlcode);
logerror();
return(false);
}
}
void Bitmaszyna::getError(struct json_object **json)
{
string err;
err=json_object_get_string(*json);
if (err!="") lasterror=err;
logerror();
json_object_put(*json);
}
bool Bitmaszyna::fetchData(struct json_object **json,struct json_object **jtmp)
{
json_object_object_get_ex(*json,"result",jtmp);
if ((*jtmp!=NULL)&&(string(json_object_get_string(*jtmp))!=string("ok"))) {
json_object_object_get_ex(*json,"reason",jtmp);
getError(jtmp);
curl_mutex.unlock();
return(false);
}
return(true);
}
bool Bitmaszyna::makeSimpleApiCall(string method,string post)
{
struct json_object *json,*jtmp;
curl_mutex.lock();
if (makeApiCall(method,&json,post))
{
if(!fetchData(&json,&jtmp)) return(false);
log(string(chunk.memory)+"\n");
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::getTickerData(string url,struct json_object **json)
{
chunk.size=0;
curl_easy_setopt(curl, CURLOPT_URL, (BITMASZYNAURL+url).c_str());
curl_easy_setopt(curl, CURLOPT_POST, 0);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, 0);
#ifdef DEBUG
log((BITMASZYNAURL+url)+"\n");
#endif
curlcode=curl_easy_perform(curl);
if (chunk.size>0)
{
if ((long)(*json=json_tokener_parse(chunk.memory))==0)
{
log("Not a json file\n");
log(string(chunk.memory)+"\n");
return(false);
}
return(true);
}
else
{
lasterror=name+" "+url+": "+curl_easy_strerror(curlcode);
logerror();
return(false);
}
}
string Bitmaszyna::strfromtype(char type)
{
if (type==BUY) return("buypair");
else if (type==SELL) return("sellpair");
else return("");
}
Bitmaszyna::~Bitmaszyna() {
}
bool Bitmaszyna::marketChart(string market,long starttime,long endtime,long interval)
{
struct json_object *json,*jtmp2,*jtmp3;
struct array_list *arr;
int i;
curl_mutex.lock();
if (getTickerData(market+"/chartData.json?starttime="+to_stringl(starttime).toStdString()+"&endtime="+to_stringl(endtime).toStdString()+"&interval="+to_stringl(interval).toStdString(),&json))
{
base->swieczki.clear();
arr=json_object_get_array(json);
for(i=0;i<arr->length;i++)
{
Ohlc s;
jtmp2=(struct json_object *)array_list_get_idx(arr,i);
json_object_object_get_ex(jtmp2,"time",&jtmp3);
s.t=json_object_get_int64(jtmp3);
json_object_object_get_ex(jtmp2,"open",&jtmp3);
s.o=json_object_get_double(jtmp3);
json_object_object_get_ex(jtmp2,"close",&jtmp3);
s.c=json_object_get_double(jtmp3);
json_object_object_get_ex(jtmp2,"high",&jtmp3);
s.h=json_object_get_double(jtmp3);
json_object_object_get_ex(jtmp2,"low",&jtmp3);
s.l=json_object_get_double(jtmp3);
base->swieczki.push_back(s);
}
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::swapOpen(string currency,double amount,double rate)
{
Q_UNUSED(currency);
Q_UNUSED(amount);
Q_UNUSED(rate);
return(true);
}
bool Bitmaszyna::swapList(string currency)
{
Q_UNUSED(currency);
return(true);
}
bool Bitmaszyna::swapClose(string,string id)
{
Q_UNUSED(id);
return(true);
}
bool Bitmaszyna::marginList(string market)
{
Q_UNUSED(market);
return(true);
}
bool Bitmaszyna::history(string currency)
{
Q_UNUSED(currency);
return(true);
}
bool Bitmaszyna::transfers(int count,int start)
{
Q_UNUSED(count);
Q_UNUSED(start);
return(true);
}
bool Bitmaszyna::withdrawals(int count,int start)
{
Q_UNUSED(count);
Q_UNUSED(start);
return(true);
}
bool Bitmaszyna::transfer(string,string,double)
{
return(true);
}
bool Bitmaszyna::marginOpen(string market,char type,double leverage,double amount,double rate,double rateLoss,double rateProfit)
{
Q_UNUSED(market);
Q_UNUSED(type);
Q_UNUSED(leverage);
Q_UNUSED(amount);
Q_UNUSED(rate);
Q_UNUSED(rateLoss);
Q_UNUSED(rateProfit);
return(true);
}
bool Bitmaszyna::marginClose(string market,string id,double amount)
{
Q_UNUSED(market);
Q_UNUSED(id);
Q_UNUSED(amount);
return(true);
}
bool Bitmaszyna::marginCancel(string market,string id,double amount)
{
Q_UNUSED(market);
Q_UNUSED(id);
Q_UNUSED(amount);
return(true);
}
bool Bitmaszyna::marginModify(string market,string id,double rate,double rateLoss,double rateProfit)
{
Q_UNUSED(market);
Q_UNUSED(id);
Q_UNUSED(rate);
Q_UNUSED(rateLoss);
Q_UNUSED(rateProfit);
return(true);
}
bool Bitmaszyna::getticker(string market,Ticker& t)
{
struct json_object *json,*jtmp;
curl_mutex.lock();
if (getTickerData(market+"/ticker.json",&json))
{
json_object_object_get_ex(json,"ask",&jtmp);
t.ask=json_object_get_double(jtmp);
json_object_object_get_ex(json,"bid",&jtmp);
t.bid=json_object_get_double(jtmp);
json_object_object_get_ex(json,"last",&jtmp);
t.last=json_object_get_double(jtmp);
json_object_object_get_ex(json,"high",&jtmp);
t.high=json_object_get_double(jtmp);
json_object_object_get_ex(json,"low",&jtmp);
t.low=json_object_get_double(jtmp);
json_object_object_get_ex(json,"volume1",&jtmp);
t.volume=json_object_get_double(jtmp);
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::withdraw(double amount,const string& currency,const string& address,const string& swift,const string& note,bool test,int type,double& fee)
{
Q_UNUSED(swift);
Q_UNUSED(note);
Q_UNUSED(test);
Q_UNUSED(fee);
string ex;
if (test) return(true);
if (type==WITHDRAW_FAST) ex="true";
else ex="false";
return(makeSimpleApiCall("withdrawal",string("nonce=")+to_stringl(getctime()).toStdString()+"&account="+address+"&amount="+to_stringd(amount).toStdString()+"&cur="+currency+"&express="+ex));
}
bool Bitmaszyna::deposit(const string&)
{
return(false);
}
bool Bitmaszyna::lasttrades(string market)
{
struct json_object *json,*jtmp,*jtmp2;
struct array_list *arr;
int i;
curl_mutex.lock();
trades.clear();
if (getTickerData(market+"/transactions.json",&json))
{
arr=json_object_get_array(json);
for(i=0;i<arr->length;i++)
{
Offer offer;
jtmp=(struct json_object *)array_list_get_idx(arr,i);
json_object_object_get_ex(jtmp,"date",&jtmp2);
offer.time=json_object_get_int64(jtmp2);
json_object_object_get_ex(jtmp,"price",&jtmp2);
offer.price=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"amount",&jtmp2);
offer.amount=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"type",&jtmp2);
offer.type=json_object_get_int(jtmp2);
json_object_object_get_ex(jtmp,"type",&jtmp2);
offer.id=json_object_get_int(jtmp2);
trades.push_back(offer);
}
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::tradepair(double price,double amount,char type,string market)
{
#ifdef ARMED
string b;
if (type==BUY) b="buy";
else if (type==SELL) b="sell";
return(makeSimpleApiCall(market+"/"+b,string("nonce=")+to_stringl(getctime()).toStdString()+"&price="+to_stringp(price).toStdString()+"&amount="+to_stringd(amount).toStdString()+"&offer=true"));
#else
Q_UNUSED(price);
Q_UNUSED(amount);
Q_UNUSED(type);
Q_UNUSED(market);
return(true);
#endif
}
bool Bitmaszyna::getAccountInfo()
{
struct json_object *json,*jtmp,*jtmp2,*jtmp3;
struct array_list *arr,*arr2;
int i,j;
curl_mutex.lock();
if (makeApiCall("accountInfo",&json,string("nonce=")+to_stringl(getctime()).toStdString()))
{
if (!fetchData(&json,&jtmp)) return(false);
log(string(chunk.memory)+"\n");
json_object_object_get_ex(json,"deposits",&jtmp);
arr=json_object_get_array(jtmp);
deposits.clear();
for(i=0;i<arr->length;i++)
{
Deposit d;
jtmp2=(struct json_object *)array_list_get_idx(arr,i);
json_object_object_get_ex(jtmp2,"currency",&jtmp3);
d.currency=json_object_get_string(jtmp3);
json_object_object_get_ex(jtmp2,"bank_name",&jtmp3);
d.bank_name=json_object_get_string(jtmp3);
json_object_object_get_ex(jtmp2,"pay_to",&jtmp3);
d.pay_to=json_object_get_string(jtmp3);
json_object_object_get_ex(jtmp2,"acc_num",&jtmp3);
d.acc_num=json_object_get_string(jtmp3);
json_object_object_get_ex(jtmp2,"swift_code",&jtmp3);
d.swift_code=json_object_get_string(jtmp3);
json_object_object_get_ex(jtmp2,"transfer_title",&jtmp3);
d.transfer_title=json_object_get_string(jtmp3);
deposits.push_back(d);
}
json_object_object_get_ex(json,"withdrawalAccounts",&jtmp);
arr=json_object_get_array(jtmp);
for(j=0;j<arr->length;j++)
{
withdrawalaccounts[j].clear();
arr2=json_object_get_array((struct json_object *)array_list_get_idx(arr,j));
for(i=0;i<arr2->length;)
{
WithdrawalAccount w;
jtmp2=(struct json_object *)array_list_get_idx(arr2,i);
w.account=json_object_get_string(jtmp2);
i++;
jtmp2=(struct json_object *)array_list_get_idx(arr2,i);
w.name=json_object_get_string(jtmp2);
i++;
if (w.account.size()>0) withdrawalaccounts[adjustCurrency(j)].push_back(w);
}
}
json_object_put(json);
logged=true;
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
int Bitmaszyna::adjustCurrency(int in)
{
if (in==0) return(BTC);
else if (in==1) return(LTC);
else if (in==2) return(PLN);
return(-1);
}
bool Bitmaszyna::getfunds()
{
struct json_object *json,*jtmp,*jtmp2;
curl_mutex.lock();
if (makeApiCall("funds",&json,string("nonce=")+to_stringl(getctime()).toStdString()))
{
if (!fetchData(&json,&jtmp)) return(false);
log(string(chunk.memory)+"\n");
json_object_object_get_ex(json,"funds",&jtmp);
json_object_object_get_ex(jtmp,"available_BTC",&jtmp2);
balance.balance[BTC]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"blocked_BTC",&jtmp2);
balance.blocked[BTC]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"available_LTC",&jtmp2);
balance.balance[LTC]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"blocked_LTC",&jtmp2);
balance.blocked[LTC]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"available_KBM",&jtmp2);
balance.balance[KBM]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"blocked_KBM",&jtmp2);
balance.blocked[KBM]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"available_PLN",&jtmp2);
balance.balance[PLN]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"blocked_PLN",&jtmp2);
balance.blocked[PLN]=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"takerfee",&jtmp2);
fees.taker=json_object_get_double(jtmp2);
json_object_object_get_ex(jtmp,"makerfee",&jtmp2);
fees.maker=json_object_get_double(jtmp2);
json_object_put(json);
logged=true;
curl_mutex.unlock();
return(getAccountInfo());
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::getdepth(string market,Tables& tables)
{
struct json_object *json,*jtmp;
struct array_list *arr,*arr2;
int i;
double sum;
curl_mutex.lock();
tables.bids.clear();
tables.asks.clear();
if (getTickerData(market+"/depthSimple.json",&json))
{
json_object_object_get_ex(json,"bids",&jtmp);
arr=json_object_get_array(jtmp);
sum=0.0;
for(i=0;i<arr->length;i++)
{
Offer offer;
jtmp=(struct json_object *)array_list_get_idx(arr,i);
arr2=json_object_get_array(jtmp);
offer.type=BID;
offer.price=json_object_get_double((struct json_object *)array_list_get_idx(arr2,0));
offer.amount=json_object_get_double((struct json_object *)array_list_get_idx(arr2,1));
offer.sum=sum;
sum+=offer.amount;
tables.bids.push_back(offer);
}
json_object_object_get_ex(json,"asks",&jtmp);
arr=json_object_get_array(jtmp);
sum=0.0;
for(i=0;i<arr->length;i++)
{
Offer offer;
jtmp=(struct json_object *)array_list_get_idx(arr,i);
arr2=json_object_get_array(jtmp);
offer.type=BID;
offer.price=json_object_get_double((struct json_object *)array_list_get_idx(arr2,0));
offer.amount=json_object_get_double((struct json_object *)array_list_get_idx(arr2,1));
offer.sumLower=sum;
sum+=offer.amount*offer.price;
tables.asks.push_back(offer);
}
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::getopenorders(string)
{
struct json_object *json,*jtmp;
struct array_list *arr;
int i;
Offer o;
curl_mutex.lock();
orders.clear();
if (makeApiCall("offers",&json,string("nonce=")+to_stringl(getctime()).toStdString()))
{
if (!fetchData(&json,&jtmp)) return(false);
json_object_object_get_ex(json,"orders",&jtmp);
arr=json_object_get_array(jtmp);
for(i=0;i<arr->length;i++)
{
struct json_object *jtmp3,*jtmp4;
jtmp3=(struct json_object *)array_list_get_idx(arr,i);
json_object_object_get_ex(jtmp3,"id",&jtmp4);
o.id=to_stringl(json_object_get_int(jtmp4)).toStdString();
json_object_object_get_ex(jtmp3,"price",&jtmp4);
o.price=json_object_get_double(jtmp4);
json_object_object_get_ex(jtmp3,"amount",&jtmp4);
o.amount=json_object_get_double(jtmp4);
json_object_object_get_ex(jtmp3,"type",&jtmp4);
o.type=json_object_get_double(jtmp4);
orders.push_back(o);
}
json_object_put(json);
curl_mutex.unlock();
return(true);
}
curl_mutex.unlock();
return(false);
}
bool Bitmaszyna::cancelorder(string id)
{
#ifdef ARMED
return(makeSimpleApiCall("canceloffer",string("nonce=")+to_stringl(getctime()).toStdString()+"&id="+id));
#else
Q_UNUSED(id);
return(true);
#endif
}
bool Bitmaszyna::cancelall()
{
vector<Offer>::iterator it;
for(it=orders.begin();it!=orders.end();++it)
{
cancelorder(it->id);
}
return(true);
}
bool Bitmaszyna::marginBalanceAdd(string,double)
{
return(true);
}
bool Bitmaszyna::marginBalanceRemove(string,double)
{
return(true);
}