Skip to content

Commit 98335b4

Browse files
author
Stan Drozd
committed
pyth.cpp: upd_price takes price value, confidence and symbol status
1 parent b958865 commit 98335b4

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

pcapps/pyth.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int usage()
4747
std::cerr << " del_publisher <pub_key> <price_key> [options]"
4848
<< std::endl;
4949
std::cerr << " upd_product <product.json> [options]" << std::endl;
50-
std::cerr << " upd_price <price_key> [options]"
50+
std::cerr << " upd_price <price_key> <value> <confidence> <status> [options]"
5151
<< std::endl;
5252
std::cerr << " upd_test <test_key> <test.json> [options]"
5353
<< std::endl;
@@ -801,14 +801,26 @@ int on_upd_test( int argc, char **argv )
801801

802802
int on_upd_price( int argc, char **argv )
803803
{
804-
if ( argc < 2 ) {
804+
if ( argc < 5 ) {
805805
return usage();
806806
}
807+
808+
// Price Key
807809
std::string pkey( argv[1] );
808810
pub_key pub;
809811
pub.init_from_text( pkey );
810-
argc -= 1;
811-
argv += 1;
812+
813+
// Price Value
814+
uint64_t price_value = atoll(argv[2]);
815+
816+
// Confidence
817+
uint64_t confidence = atoll(argv[3]);
818+
819+
// Status
820+
symbol_status price_status = str_to_symbol_status(argv[4]);
821+
822+
argc -= 4;
823+
argv += 4;
812824

813825
int opt = 0;
814826
commitment cmt = commitment::e_confirmed;
@@ -851,7 +863,7 @@ int on_upd_price( int argc, char **argv )
851863
std::cerr << "pyth: missing publisher permission" << std::endl;
852864
return 1;
853865
}
854-
ptr->update();
866+
ptr->update(price_value, confidence, price_status);
855867
while( mgr.get_is_tx_send() && !mgr.get_is_err() ) {
856868
mgr.poll();
857869
}

0 commit comments

Comments
 (0)