Example #1
0
def _load_data(credentials):
    """
    Load data by using debrit API
    Need to put the openapi_client python in parent folder
    :param credentials: dic with key and secret information
    :return return the required data
    """
    conf = openapi_client.Configuration()
    client = openapi_client.api_client.ApiClient(conf)
    publicApi = openapi_client.api.public_api.PublicApi(client)
    response = publicApi.public_auth_get('client_credentials',
                                         '',
                                         '',
                                         credentials['auth_key'],
                                         credentials['auth_secret'],
                                         '',
                                         '',
                                         '',
                                         scope='session:test wallet:read')
    access_token = response['result']['access_token']
    # Set up token information
    conf_authed = openapi_client.Configuration()
    conf_authed.access_token = access_token
    client_authed = openapi_client.api_client.ApiClient(conf_authed)
    # Create an instance of the market api class
    market_api_instance = openapi_client.api.market_data_api.MarketDataApi(
        client_authed)
    currency = 'BTC'
    kind = 'option'
    api_response = market_api_instance.public_get_book_summary_by_currency_get(
        currency, kind=kind)
    return api_response['result']
Example #2
0
def _deribit_api_client(credentials):
    """
    Take creds and return api client
    """
    global _market_api_instance
    if _market_api_instance == None:

        conf = openapi_client.Configuration()
        client = openapi_client.api_client.ApiClient(conf)
        publicApi = openapi_client.api.public_api.PublicApi(client)
        response = publicApi.public_auth_get('client_credentials',
                                             '',
                                             '',
                                             credentials['auth_key'],
                                             credentials['auth_secret'],
                                             '',
                                             '',
                                             '',
                                             scope='session:test wallet:read')
        access_token = response['result']['access_token']
        # Set up token information
        conf_authed = openapi_client.Configuration()
        conf_authed.access_token = access_token
        client_authed = openapi_client.api_client.ApiClient(conf_authed)
        # Create an instance of the market api class
        _market_api_instance = openapi_client.api.market_data_api.MarketDataApi(
            client_authed)

    return _market_api_instance
def configuration():
    openapi_host = os.environ.get("OPENAPI_HOST")
    if openapi_host is None:
        configuration = openapi_client.Configuration()
    else:
        configuration = openapi_client.Configuration(host=openapi_host)

    configuration.access_token = "YOUR_ACCESS_TOKEN"
    return configuration
Example #4
0
    def setUp(self):
        configuration = openapi_client.Configuration()
        configuration.debug = False
        api_client = openapi_client.ApiClient(configuration)

        self.sort = openapi_client.api.sort_api.SortApi(api_client)
        self.bucket = openapi_client.api.bucket_api.BucketApi(api_client)
        self.object = openapi_client.api.object_api.ObjectApi(api_client)
        self.models = openapi_client.models

        # Create local bucket
        input_params = self.models.InputParameters(
            self.models.Actions.CREATELB)
        self.bucket.perform_operation(self.BUCKET_NAME, input_params)

        # Create and send tars
        for i in range(0, self.SHARDS):
            out = io.BytesIO()
            object_name = "%s%d.tar" % (self.PREFIX, i)
            with tarfile.open(mode="w", fileobj=out) as tar:
                for j in range(0, 100):
                    b = "Hello world!".encode("ascii")
                    t = tarfile.TarInfo("%d.txt" % j)
                    t.size = len(b)
                    tar.addfile(t, io.BytesIO(b))

            self.object.put(self.BUCKET_NAME, object_name, body=out.getvalue())
Example #5
0
def main(server: str, imagefolder: str, authToken:str):

    configuration = openapi_client.Configuration(host=server)
    configuration.api_key["tokenAuth"] = authToken
    configuration.api_key_prefix["tokenAuth"] = "Token"

    with openapi_client.ApiClient(configuration) as api_client:
        submissions_api_instance = SubmissionsApi(api_client)
        fetch_api_instance = FetchsApi(api_client)

    submissions: List[Submission] = find_submissions(submissions_api_instance)
    for submission in submissions:
        print(submission.status, submission.target_url, submission.title)
        if hasattr(submission, "fetch"):
            print(f"  - retrieving {submission.fetch}")
            fetchobj: Fetch = fetch_api_instance.fetchs_retrieve(submission.id)
            if hasattr(fetchobj, "generated_thumbnail"):
                previous = fetchobj.generated_thumbnail
            else:
                previous = None
            print(f"  - generating {submission.id} to save in {imagefolder}")
            new_image = generate_thumbnail(imagefolder, fetchobj)
            patchedfetch: PatchedFetch = PatchedFetch(generated_thumbnail=new_image)
            if previous != new_image:
                print(f"  - saving {submission.id} with {patchedfetch.generated_thumbnail}")
                fetch_api_instance.fetchs_partial_update(submission.id, patched_fetch=patchedfetch)
Example #6
0
def api_factory(request, user, auths, method):

    configuration = openapi_client.Configuration()

    # Not allowed to be None
    configuration.access_token = 'abcd'
    if not auths or 'editor' in auths:
        if os.getenv('TOKEN_URL') and not os.getenv('LOCAL_TEST'):
            # Could be str(auths) if want separate tokens
            cache_key = 'cache_key'
            if cache_key in access_token_cache:
                configuration.access_token = access_token_cache[cache_key]
            else:
                with open('../upload/config_dev.json') as json_file:
                    args = json.load(json_file)
                    token_request = requests.get(
                        os.getenv('TOKEN_URL'),
                        args,
                        headers={'service': 'http://localhost/'})
                    token_response = token_request.text.split('=')
                    token = token_response[1].split('&')[0]
                    configuration.access_token = token
                    access_token_cache[cache_key] = token

    configuration.host = "http://localhost:8080/v1"

    api_client = openapi_client.ApiClient(configuration)

    yield ApiFactory(user, auths, method, api_client)
Example #7
0
def post_articles(server: str, token: str, submissions: List[Submission]):
    configuration = openapi_client.Configuration(host=server)
    configuration.api_key['tokenAuth'] = token
    configuration.api_key_prefix['tokenAuth'] = 'Token'

    for submission in submissions:
        with openapi_client.ApiClient(configuration) as api_client:
            api_instance = submissions_api.SubmissionsApi(api_client)

        try:
            print(f'Sending {submission.target_url}')
            api_response = api_instance.submissions_create(submission)
            # pprint(api_response)
            print('    ok')
        except openapi_client.ApiException as e:
            if e.status in [401, 403]:
                print('    %d error code - failed to login' % (e.status))
                print(e.headers)
                print('    make sure the provided token is valid')
                sys.exit(1)
            elif e.status in [400, 500]:
                if 'already exists' in e.body or 'already exists' in e.reason:
                    print('    already exists, ignored')
                    continue
                print('    %d critical error received' % e.status)
                print('    ERROR --->', e.body)
                sys.exit(1)
            else:
                print(
                    "Exception when calling SubmissionsApi->submissions_create: %s\n"
                    % e)
        except urllib3.exceptions.MaxRetryError:
            print("ERROR: Cannot connect to server - after retrying.")
            sys.exit(1)
Example #8
0
def example_api_get_project():
    #  Set the configuration
    configuration = openapi_client.Configuration(
        host=example_host,
    )
    configuration.verify_ssl = False
    configuration.ssl_ca_cert = None
    configuration.assert_hostname = False
    configuration.cert_file = None

    #  Get an access token and add it to the configuration
    with openapi_client.ApiClient(configuration) as api_client:
        api_instance_auth = openapi_client.AuthenticationApi(api_client)
        body_login = openapi_client.ApiCredentials(password=example_password, username=example_username)
        api_response = api_instance_auth.login(body_login)
        configuration.access_token = api_response.token

        # Create a ProjectApi instance to make API storage commands
        api_instance = openapi_client.ProjectApi(api_client)

        print("# Get a single project")
        try:
            api_response = api_instance.get_project(project_name="Example-Archive-Project")
            pprint(api_response)
        except ApiException as e:
            print("Exception when calling ProjectApi->get_project (example GET single project): %s\n" % e)

        print("# Get ALL projects")
        try:
            api_response = api_instance.list_projects()
            pprint(api_response)
        except ApiException as e:
            print("Exception when calling ProjectApi->list_projects (example GET list of projects): %s\n" % e)
Example #9
0
    def create_connection(self):
        '''
        Connects to deribit api and prescribes access token to bot
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!
        '''
        assert not self.__client_id == 'not configured',     "Client ID is not configured!"
        assert not self.__client_secret == 'not configured', "Client Secret is not configured!" 
        assert not self.__host          == 'not configured', "Host is not configured!" 
        
        configuration = openapi_client.Configuration()
        configuration.host = self.__host
        configuration.access_token = self.__client_id

        auth_api_instance = openapi_client.AuthenticationApi(openapi_client.ApiClient(configuration))
       
        grant_type = 'client_credentials' 
        client_id = self.__client_id 
        client_secret = self.__client_secret
        scope = 'trade:read_write'
        
        try:
            api_response = auth_api_instance.public_auth_get(grant_type, '', '', client_id, client_secret, '', '', '',  scope=scope)
            
        except ApiException as e:
            print("Exception when calling AuthenticationApi->public_auth_get: %s\n" % e)

        self.__access_token = api_response['result']['access_token']
Example #10
0
    def get_orders(self):
        '''
        Gets historical orders data 
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!
        
        '''        
        self.create_connection()
        
        configuration = openapi_client.Configuration()
        configuration.access_token = self.__access_token
        configuration.host = self.__host

        api_instance = openapi_client.PrivateApi(openapi_client.ApiClient(configuration))
        instrument_name = 'BTC-PERPETUAL' 
        count = 100
        offset = 0 
        include_old = 'true'
        include_unfilled = 'true'

        try:
            # Retrieves list of user's open orders within given Instrument.
            api_response = api_instance.private_get_order_history_by_instrument_get(instrument_name, count=count, offset=offset, include_old=include_old, include_unfilled=include_unfilled)
        except ApiException as e:
            print("Exception when calling PrivateApi->private_get_open_orders_by_instrument_get: %s\n" % e)
        
        self.__orders = api_response['result']
Example #11
0
    def get_price(self):
       
        '''
        Shows current mark price 
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!
        
        Return value: float
        Current mark price
        
        '''
        self.create_connection()
        
        configuration = openapi_client.Configuration()
        configuration.access_token = self.__access_token
        configuration.host = self.__host


        api_instance = openapi_client.PublicApi(openapi_client.ApiClient(configuration))
        instrument_name = 'BTC-PERPETUAL'
        depth = 1 

        try:
            # Retrieves the order book, along with other market values for a given instrument.
            api_response = api_instance.public_get_order_book_get(instrument_name, depth=depth)
            return api_response['result']['mark_price']
        except ApiException as e:
            print("Exception when calling PublicApi->public_get_order_book_get: %s\n" % e)
Example #12
0
    def __init__(self, logger_name):
        ServiceBase.__init__(self, logger_name)

        # servie id used for control
        # self.sid = 'sid002'

        # SUB data
        self.deribitmsgclient = self.ctx.socket(zmq.SUB)
        self.deribitmsgclient.connect('tcp://localhost:9000')
        self.deribitmsgclient.setsockopt_string(zmq.SUBSCRIBE, '')

        self.okexmsgclient = self.ctx.socket(zmq.SUB)
        self.okexmsgclient.connect('tcp://localhost:9100')
        self.okexmsgclient.setsockopt_string(zmq.SUBSCRIBE, '')

        self.okexclient = OptionAPI('3b43d558-c6e6-4460-b8dd-1e542bc8c6c1',
                                    '90EB8F53AABAE20C67FB7E3B0EFBB318',
                                    'mogu198812', True)

        self.deribitauth = openapi_client.AuthenticationApi()
        res = self.deribitauth.public_auth_get(grant_type='client_credentials',
                                               username='',
                                               password='',
                                               client_id=deribit_apikey,
                                               client_secret=deribit_apisecret,
                                               refresh_token='',
                                               timestamp='',
                                               signature='')
        self.deribitconfig = openapi_client.Configuration()
        self.deribitconfig.access_token = res['result']['access_token']
        self.deribitconfig.refresh_token = res['result']['refresh_token']
        self.deribittradingapi = openapi_client.TradingApi(
            openapi_client.ApiClient(self.deribitconfig))
Example #13
0
    def getApiClient(self):
        auth_token = None
        configuration = openapi_client.Configuration()

        if os.getenv('TOKEN_URL') and not os.getenv('BB_NOAUTH'):
            try:
                with open(self._config_file) as json_file:
                    args = json.load(json_file)
                    r = requests.get(os.getenv('TOKEN_URL'),
                                     args,
                                     headers={'service': 'http://localhost/'})
                    at = r.text.split('=')
                    token = at[1].split('&')[0]
                    auth_token = token
                configuration.access_token = auth_token
            except FileNotFoundError as fnfe:
                print('No config file found: {}'.format(TestBase._config_file))
                pass

        if os.getenv('REMOTE_HOST_URL'):
            configuration.host = "http://localhost:8080/v1"

        api_client = openapi_client.ApiClient(configuration)

        return api_client
Example #14
0
 def setUp(self):
     configuration = openapi_client.Configuration()
     configuration.debug = False
     api_client = openapi_client.ApiClient(configuration)
     self.cluster = openapi_client.api.cluster_api.ClusterApi(api_client)
     self.daemon = openapi_client.api.daemon_api.DaemonApi(api_client)
     self.models = openapi_client.models
Example #15
0
    def setup(self, config_file):
        # Configure OAuth2 access token for authorization: OauthSecurity
        auth_token = self.get_access_token(config_file)

        configuration = openapi_client.Configuration()
        if auth_token:
            configuration.access_token = auth_token

        if os.getenv('REMOTE_HOST_URL'):
            configuration.host = "http://localhost:8080/v1"

        self.es_api_instance = openapi_client.EventSetApi(
            openapi_client.ApiClient(configuration))
        self.location_api_instance = openapi_client.LocationApi(
            openapi_client.ApiClient(configuration))
        self.se_api_instance = openapi_client.SamplingEventApi(
            openapi_client.ApiClient(configuration))
        self.os_api_instance = openapi_client.OriginalSampleApi(
            openapi_client.ApiClient(configuration))
        self.ds_api_instance = openapi_client.DerivativeSampleApi(
            openapi_client.ApiClient(configuration))
        self.ad_api_instance = openapi_client.AssayDataApi(
            openapi_client.ApiClient(configuration))
        self.metadata_api_instance = openapi_client.MetadataApi(
            openapi_client.ApiClient(configuration))
        self.study_api_instance = openapi_client.StudyApi(
            openapi_client.ApiClient(configuration))
        self.i_api_instance = openapi_client.IndividualApi(
            openapi_client.ApiClient(configuration))
Example #16
0
    def are_orders_closed(self):
        '''
        Shows if all the orders are closed
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!
        
        Return value: bool
        True if all orders are closed
        False else
        '''
            
        self.create_connection()
        
        configuration = openapi_client.Configuration()
        configuration.access_token = self.__access_token
        configuration.host = self.__host

        api_instance = openapi_client.PrivateApi(openapi_client.ApiClient(configuration))
        instrument_name = 'BTC-PERPETUAL' # str | Instrument name
        type = 'all' # str | Order type, default - `all` (optional)

        try:
            # Retrieves list of user's open orders within given Instrument.
            api_response = api_instance.private_get_open_orders_by_instrument_get(instrument_name, type=type)
        except ApiException as e:
            print("Exception when calling PrivateApi->private_get_open_orders_by_instrument_get: %s\n" % e)
        
        return len(api_response['result']) == 0
Example #17
0
 def setUp(self):
     self.config = openapi_client.Configuration(
         host="https://conjur-https",
         api_key={'conjurAuth': os.environ['CONJUR_AUTHN_API_KEY']})
     cert_path = pathlib.Path(CERT_PATH)
     self.config.ssl_ca_cert = cert_path.joinpath(SSL_CERT_FILE)
     self.config.cert_file = cert_path.joinpath(CONJUR_CERT_FILE)
     self.config.key_file = cert_path.joinpath(CONJUR_KEY_FILE)
Example #18
0
    def setUp(self):
        surpressResourceWarning()

        configuration = openapi_client.Configuration()
        configuration.debug = False
        api_client = openapi_client.ApiClient(configuration)
        self.daemon = openapi_client.api.daemon_api.DaemonApi(api_client)
        self.models = openapi_client.models
 def setUp(self):
     self.log = Logger.getLoggerObj()
     self.log.info("")
     self.log.info("Setting up the host/api url for test execution")
     configuration = openapi_client.Configuration(
         host="http://localhost:5000")
     api_client = openapi_client.ApiClient(configuration)
     self.api = openapi_client.AquaApiApi(api_client)
Example #20
0
 def get_config(self, proxy_url='', proxy_user='', proxy_pass=''):
     configuration = openapi_client.Configuration(self.host)
     configuration.access_token = self.access_token
     if proxy_url:
         configuration.proxy = proxy_url
         if proxy_user:
             configuration.proxy_headers = make_headers(
                 proxy_basic_auth=':'.join((proxy_user, proxy_pass)))
     return configuration
 def setUp(self):
     c = openapi_client.Configuration()
     c.host = BASE_PATH
     self.cli = openapi_client.ApiClient(c)
     ## Add OAuth1.0a interceptor
     add_signer_layer(self.cli, P12, KEY_PASSWORD, CONSUMER_KEY)
     ## Add Field Level Encryption interceptor
     config_file = os.path.join(os.path.dirname(__file__), FLE_CONFIG_PATH)
     add_encryption_layer(self.cli, config_file)
Example #22
0
 def __init__(self,
              settings: utils.Settings,
              allow_missing_saved_state: bool = False):
     """Set up a 3di API connection."""
     self.settings = settings
     self.allow_missing_saved_state = allow_missing_saved_state
     self.configuration = openapi_client.Configuration(host=API_HOST)
     self.api_client = openapi_client.ApiClient(self.configuration)
     self.api_client.user_agent = USER_AGENT  # Let's be neat.
     self.output_dir = self.settings.base_dir / "output"
     self.output_dir.mkdir(exist_ok=True)
Example #23
0
def get_api_client(access_token) -> Optional[ApiClient]:
    if not access_token:
        print("Fehler beim Login")
        return None

    configuration = openapi_client.Configuration(
        host="https://hugo-staging.pragmaticindustries.com/api")
    client = ApiClient(configuration=configuration,
                       header_name="Authorization",
                       header_value=f"Bearer {access_token}")

    return client
Example #24
0
 def setUp(self):
     configuration = openapi_client.Configuration()
     configuration.debug = False
     api_client = openapi_client.ApiClient(configuration)
     self.object = openapi_client.api.object_api.ObjectApi(api_client)
     self.bucket = openapi_client.api.bucket_api.BucketApi(api_client)
     self.models = openapi_client.models
     self.BUCKET_NAME = os.environ["BUCKET"]
     self.assertTrue(self.BUCKET_NAME,
                     "Environment variable 'BUCKET' not set.")
     self.FILE_SIZE = 128
     self.created_objects = []
     self.created_buckets = []
Example #25
0
 def setUp(self):
     configuration = openapi_client.Configuration()
     configuration.debug = False
     api_client = openapi_client.ApiClient(configuration)
     self.bucket = openapi_client.api.bucket_api.BucketApi(api_client)
     self.object = openapi_client.api.object_api.ObjectApi(api_client)
     self.models = openapi_client.models
     self.BUCKET_NAME = os.environ["BUCKET"]
     self.NEXT_TIER_URL = "http://foo.com"
     self.FILE_SIZE = 128
     self.SLEEP_LONG_SECONDS = 15
     self.created_objects = []
     self.created_buckets = []
    def main(self):
        self._args = docopt(__doc__)
        logging.basicConfig(level=-10 * self._args["-v"] + 30)

        if not (self._args["--monitor-room-schedule"]
                or self._args["--record-now"]):
            self._log.error("Please provide an operation option")
            exit(1)

        self._cam = PiCamInterface()
        self._api_conf = openapi_client.Configuration(
            host=self._args["--api-url"])
        self._api_conf.verify_ssl = False if self._args[
            "--no-verify-certs"] else True
        self._api_client = openapi_client.ApiClient(
            configuration=self._api_conf)
        self._auth_api = openapi_client.AuthenticationApi(self._api_client)
        self._schedule_api = openapi_client.ScheduleApi(self._api_client)
        self._video_upload_api = openapi_client.VideostreamApi(
            self._api_client)
        self._recorder = RecordHandler(ul_api=self._video_upload_api,
                                       video_intf=self._cam,
                                       audio_intf=None,
                                       buffer_size=int(
                                           self._args["--mem-buffer-size"]))

        auth_token = self._get_jwt_token(self._args["<vc_username>"],
                                         self._args["<vc_password>"])
        if auth_token:
            self._api_conf.access_token = auth_token
            self._log.debug("Authorized as %s with JWT token %s" %
                            (self._args["<vc_username>"], auth_token))
        else:
            self._log.error("Unable to authenticate as %s. Exiting.." %
                            self._args["<vc_username>"])
            exit(1)

        if self._args["--record-now"]:
            self._start_recording_now(int(self._args["--record-now"]))

        if self._args["--monitor-room-schedule"]:
            self._log.info(
                "Recording sessions upcoming in room %s indefinitely. Ctrl-C to terminate",
                self._args["--monitor-room-schedule"])
            if self._update_schedule_jobs():
                schedule.every().day.at("06:00").do(self._update_schedule_jobs)

                while True:
                    schedule.run_pending()
                    sleep(5)
Example #27
0
        def createAisApiClients(daemonlist):
            """ Create openapi client API handles for a list of daemons (does not initiate connection yet). """

            for d in daemonlist:
                if d['pod'].status.pod_ip is None:
                    d['aisClientApi'] = None
                    continue

                config = openapi_client.Configuration()
                config.debug = False
                config.host = "http://%s:%s/v1/" % (
                    d['pod'].status.pod_ip,
                    d['pod'].spec.containers[0].ports[0].container_port)
                d['aisClientApi'] = openapi_client.ApiClient(config)
Example #28
0
def example_api_login():
    #  Set the configuration
    configuration = openapi_client.Configuration(
        host=example_host,
    )
    configuration.verify_ssl = False
    configuration.ssl_ca_cert = None
    configuration.assert_hostname = False
    configuration.cert_file = None

    print("# Get an access token")
    with openapi_client.ApiClient(configuration) as api_client:
        api_instance_auth = openapi_client.AuthenticationApi(api_client)
        body_login = openapi_client.ApiCredentials(password=example_password, username=example_username)
        api_response = api_instance_auth.login(body_login)
        pprint(api_response)
Example #29
0
    def cancel_orders(self):
        '''
        Cancels all opened orders
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!

        '''
        self.create_connection()
        
        configuration = openapi_client.Configuration()
        configuration.access_token = self.__access_token
        configuration.host = self.__host
        
        api_instance = openapi_client.PrivateApi(openapi_client.ApiClient(configuration))

        try:
            api_response = api_instance.private_cancel_all_get()
        except ApiException as e:
            print("Exception when calling PrivateApi->private_cancel_all_get: %s\n" % e)
Example #30
0
    def open_order(self, order_type: str, price: float):
        '''
        Opens buy or sell order with specified price
        ROBOT SHOULD BE CONFIGURED BEFORE CALLING THIS FUNCTION!
        
        Params: 
        order_type: string -- type of order, possible values: 'buy', 'sell'
        price: float -- price in which order is placed, should be positive
        '''
        
        assert order_type == 'buy' or order_type == 'sell', "Order type should be 'buy' or 'sell'!"
        
        self.create_connection()
        
        configuration = openapi_client.Configuration()
        configuration.access_token = self.__access_token
        configuration.host = self.__host        
        
        api_instance = openapi_client.PrivateApi(openapi_client.ApiClient(configuration))
       
        instrument_name = 'BTC-PERPETUAL' 
        amount = 10
        type = 'limit' 
        label = 'label_example'
        price = price 
        time_in_force = 'good_til_cancelled'
        max_show = 10 
        post_only = 'true' 
        reduce_only = 'false' 

        
        try:
            if order_type == 'buy':
                api_response = api_instance.private_buy_get(instrument_name, amount, type=type, label=label, price=price, time_in_force=time_in_force, max_show=max_show, post_only=post_only, reduce_only=reduce_only)
            else:
                api_response = api_instance.private_sell_get(instrument_name, amount, type=type, label=label, price=price, time_in_force=time_in_force, max_show=max_show, post_only=post_only, reduce_only=reduce_only)
               
        except ApiException as e:
            print("Exception when calling PrivateApi->private_buy_get: %s\n" % e)

        if order_type == 'buy':
            self.__buy_price = price
        else:
            self.__sell_price = price