Api function

Custom Functions

  def function name (parameter list):
       
function body

def yuan(r,k=1):
      p=3.14
      l=2*p*r/k
      s=p*r*r/k
      return l,s

 

order_target (security, amount), meaning through the sale, the stock position was adjusted to a certain number (Unit: share).

# Adjust the number of shares to 1000 shares of Ping An Bank
  # That is, if the current number of holdings of less than 1,000 shares of Ping An Bank to buy, sell higher than that, not high not low not move.
  order_target ( "000001.XSHE", 1000)

# Through the sale of certain stock positions transferred to Value (danweu: yuan)

order_value (security, value), meaning the sale of certain Value (Unit: RMB) stock.

 # Design a function, calculate the average list

l=[1,2,3]

def pjs(a):
    print(sum(a)/len(a))

pjs(l)
 

 

Guess you like

Origin www.cnblogs.com/louyi18/p/12306729.html