Exemple #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
Exemple #2
0
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

from machine_learning.market_learning import extract_features_from_offer_snapshot

merchant_token = "{{API_TOKEN}}"

settings = {
    'merchant_id': MerchantBaseLogic.calculate_id(merchant_token),
    'marketplace_url': MerchantBaseLogic.get_marketplace_url(),
    'producer_url': MerchantBaseLogic.get_producer_url(),
    'kafka_reverse_proxy_url': MerchantBaseLogic.get_kafka_reverse_proxy_url(),
    'debug': True,
    'max_amount_of_offers': 10,
    'shipping': 5,
    'primeShipping': 1,
    'max_req_per_sec': 10.0,
    'minutes_between_learnings': 5.0,
}


def make_relative_path(path):
    script_dir = os.path.dirname(os.path.realpath(__file__))
    return os.path.join(script_dir, path)


def trigger_learning(merchant_token, merchant_id, kafka_host):