예제 #1
0
    """ if second_time:
    #print "at second time"
    api_source.take_in_array(row, keys)
    random_test_agent.updateValues(api_source.get_dict(), api_source.return_last_prices())
    second_time = False
    continue


  if counter < 40:
    # we wait 40 so that macd is valid to compute
    api_source.take_in_array(row, keys)
    continue """

    print "*"
    api_source.take_in_array(row, keys)
    random_test_agent.updateValues(api_source.get_dict(),
                                   api_source.return_last_prices())
    random_test_agent.act()
    print(str(random_test_agent.sellNum), str(random_test_agent.buyNum),
          str(random_test_agent.holdNum))

    random_val = random_test_agent.getNetWorth()
    base_case = random_test_agent.get_comparison()

    #print "the random agent makes"
    print random_val

    #print "an agent that did nothing would make below"
    print base_case

    #print "this is the amount we did better"
예제 #2
0
# make sure battery settings are good

waittime = 0
print "starting the waittime - make sure battery is fine"
time.sleep(waittime * 60)
print "finished the waittime"

# takes about 3.877 seconds for this to be called first
api_source = APICaller()
api_source.update_values()

time.sleep(8)
# this is where our agent gets feed the first information

first_dict = api_source.get_dict()
keys = []
for key in first_dict:
    keys.append(key)

minutes_to_run = 5 * 60  # number of minutes until it stops

remember_rows = []  # list of lists, to put in csv

remember_rows.append(keys)
print keys
counter = 0
print "just starting the counter"
print "PLEASE DOUBLE CHECK THAT YOU CHANGED THE FILENAME TO SAVE, and that battery life is fine"
print "IF YOU FORGOT, CANCEL IMMEDIATELY"
file_name = 'retrievingData/fifth_data.csv'
예제 #3
0
values_to_save = [["Approx net worth", "Base case net worth", "Difference"]]

counter = 0
for row in csv_f:
  counter += 1
  if first_time:
    #print "at first time"
    keys = row
    first_time = False
    continue

  if second_time:
    #print "at second time"
    api_source.take_in_array(row, keys)
    regression_agent.updateValues(api_source.get_dict(), api_source.return_last_prices())
    second_time = False
    continue


  if counter < 40:
    # we wait 40 so that macd is valid to compute
    api_source.take_in_array(row, keys)
    continue



  print "*"
  api_source.take_in_array(row, keys)
  regression_agent.updateValues(api_source.get_dict(), api_source.return_last_prices())
  regression_agent.act()
values_to_save = [["qLearning net worth", "Base case net worth", "Difference"]]

counter = 0
for row in csv_f:
  counter += 1
  if first_time:
    #print "at first time"
    keys = row
    first_time = False
    continue

  if second_time:
    #print "at second time"
    api_source.take_in_array(row, keys)
    qLearning_test_agent.updateValues(api_source.get_dict(), api_source.return_last_prices())
    second_time = False
    continue


  if counter < 40:
    # we wait 40 so that we have a valid last10 to compute sma, as well as to be consistent
    # with other agent tests
    api_source.take_in_array(row, keys)
    continue



  print "*"
  api_source.take_in_array(row, keys)
  qLearning_test_agent.updateValues(api_source.get_dict(), api_source.return_last_prices())