Skip to content

Commit 91eadd7

Browse files
jayantkJayant Krishnamurthy
andauthored
Accessors for base/quote currencies (#141)
* accessors for base/quote currencies * fix the methods * ask and you shall receive * rename method Co-authored-by: Jayant Krishnamurthy <jkrishnamurthy@jumptrading.com>
1 parent 1d040b6 commit 91eadd7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

pc/request.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,20 @@ str product::get_symbol()
295295
return sym;
296296
}
297297

298+
str product::get_base_asset()
299+
{
300+
str base;
301+
get_attr( attr_id( "base" ), base);
302+
return base;
303+
}
304+
305+
str product::get_quote_currency()
306+
{
307+
str quote;
308+
get_attr( attr_id( "quote_currency" ), quote);
309+
return quote;
310+
}
311+
298312
void product::reset()
299313
{
300314
reset_err();
@@ -491,6 +505,16 @@ str price::get_symbol()
491505
return prod_->get_symbol();
492506
}
493507

508+
str price::get_base_asset()
509+
{
510+
return prod_->get_base_asset();
511+
}
512+
513+
str price::get_quote_currency()
514+
{
515+
return prod_->get_quote_currency();
516+
}
517+
494518
bool price::get_attr( attr_id aid, str& val ) const
495519
{
496520
return prod_->get_attr( aid, val );

pc/request.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ namespace pc
157157

158158
// symbol from attr_dict
159159
str get_symbol();
160+
// Get the base currency (from attr_dict)
161+
str get_base_asset();
162+
// Get the quote currency (from attr_dict)
163+
str get_quote_currency();
160164

161165
// iterate through associated price accounts (quotes) associated
162166
// with this product
@@ -243,6 +247,12 @@ namespace pc
243247
// convenience wrapper equiv to: get_product()->get_symbol()
244248
str get_symbol();
245249

250+
// Get the base asset for the product (from the list of product attributes).
251+
str get_base_asset();
252+
253+
// Get the quote currency for the product (from the list of product attributes).
254+
str get_quote_currency();
255+
246256
// convenience wrapper equiv to: get_product()->get_sttr()
247257
bool get_attr( attr_id, str& ) const;
248258

0 commit comments

Comments
 (0)