'Where to pass the lock object? what is ws, msg?

I'm trying to use yliveticker library to connect to yahoo finance websocket and simultaneously log data into df using a different thread. I dont understand what ws and msg are this my first working websockets and multithreading. Thanks for the help.

import yliveticker as ylt
import pandas as pd
import threading
import time

message1 = [None] * 3

def call_from_ws(ws, msg, lock):
  global message1 
  lock.acquire()
  print(msg['timestamp'],msg['price'],msg['changePercent'])
  message1 = [msg['timestamp'],msg['price'],msg['changePercent']]
  lock.release()

def live_ticker(lock):
 ylt.YLiveTicker(on_ticker=call_from_ws(ws, msg, lock) , ticker_names=['AAPL'])

def add_to_df(lock):
  global message1
  m_list = []
  lock.acquire()
  mes = message1
  m_list.append(mes)
  lock.release()
  return pd.DataFrame(m_list, columns = ['Time', 'Price','Change'])



lock = threading.Lock()

thread1 = threading.Thread(target=live_ticker, args=(lock,))
thread2 = threading.Thread(target=add_to_list, args=(lock,))

thread1.start()
thread2.start()

thread1.join()
thread2.join()

print(add_to_df)

print("Main thread end.")


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source