Beispiel #1
0
 def __initialize(self):
     merchant_token = self.__get_merchant_token()
     self.settings["merchant_token"] = merchant_token
     self.settings["merchant_id"] = MerchantBaseLogic.calculate_id(
         merchant_token)
     self.settings[
         "marketplace_url"] = MerchantBaseLogic.get_marketplace_url()
     self.settings["producer_url"] = MerchantBaseLogic.get_producer_url()
     self.settings[
         "kafka_reverse_proxy_url"] = MerchantBaseLogic.get_kafka_reverse_proxy_url(
         )
     self.settings["debug"] = True
     self.settings["max_amount_of_offers"] = 10
     self.settings["shipping"] = 2
     self.settings["primeShipping"] = 1
     self.settings["max_req_per_sec"] = 10.0
     self.settings["learning_interval"] = 2.0
     self.settings["data_file"] = None
     self.settings["underprice"] = 0.2
     self.settings["initialProducts"] = 5
     self.settings["min_marketsituations"] = 50
     self.settings[
         "market_situation_csv_path"] = '../data/marketSituation.csv'
     self.settings["buy_offer_csv_path"] = '../data/buyOffer.csv'
     self.settings[
         "initial_merchant_id"] = 'DaywOe3qbtT3C8wBBSV+zBOH55DVz40L6PH1/1p9xCM='
     self.settings["testing_set_csv_path"] = '../data/marketSituation.csv'
     self.settings["output_file"] = '../tmp/out.txt'
     return self
sys.path.append('./')
sys.path.append('../')
from merchant_sdk import MerchantBaseLogic, MerchantServer
from merchant_sdk.api import PricewarsRequester, MarketplaceApi, ProducerApi
from merchant_sdk.models import Offer
'''
    Template for Ruby deployment to insert defined tokens
'''
merchant_token = "{{API_TOKEN}}"
#merchant_token = 't3LvIwV9wN3pWMBdvysjtoR3zWEV1JLtMgpedLnaiqQFEbs9alsUaLXarl6s5RmQ'

settings = {
    'merchant_id': MerchantBaseLogic.calculate_id(merchant_token),
    'marketplace_url': MerchantBaseLogic.get_marketplace_url(),
    'producer_url': MerchantBaseLogic.get_producer_url(),
    'priceDecrease': 1,
    'intervalMin': 1.0,
    'intervalMax': 1.0,
    'initialProducts': 3,
    'minPriceMargin': 16,
    'maxPriceMargin': 32,
    'shipping': 5,
    'primeShipping': 1,
    'max_req_per_sec': 10,
    'underprice': 0.01,
    'globalProfitMarginForFixPrice': 10
}


class MerchantSampleLogic(MerchantBaseLogic):