class_docstr: Create a new position in the portfolio.
  
  Parameters
  ----------
  portfolio : alphaPy.portfolio
      The portfolio that will contain the position.
  name : str
      A unique identifier such as a stock symbol.
  opendate : datetime
      Date the position is opened.
  
  Attributes
  ----------
  date : timedate
      Current date of the position.
  name : str
      A unique identifier.
  status : str
      State of the position: ``'opened'`` or ``'closed'``.
  mpos : str
      Market position ``'long'`` or ``'short'``.
  quantity : float
      The net size of the position.
  price : float
      The current price of the instrument.
  value : float
      The total dollar value of the position.
  profit : float
      The net profit of the current position.
  netreturn : float
      The Return On Investment (ROI), or net return.
  opened : datetime
      Date the position is opened.
  held : int
      The holding period since the position was opened.
  costbasis : float
      Overall cost basis.
  trades : list of Trade
      The executed trades for the position so far.
  ntrades : int
      Total number of trades.
  pdata : pandas DataFrame
      Price data for the given ``name``.
  multiplier : float
      Multiple for instrument type (e.g., 1.0 for stocks).
class_docstr_tok: ["Create","a","new","position","in","the","portfolio",".","Parameters","--","--","--","--","--","portfolio",":","alphaPy.portfolio","The","portfolio","that","will","contain","the","position",".","name",":","str","A","unique","identifier","such","as","a","stock","symbol",".","opendate",":","datetime","Date","the","position","is","opened",".","Attributes","--","--","--","--","--","date",":","timedate","Current","date","of","the","position",".","name",":","str","A","unique","identifier",".","status",":","str","State","of","the","position",":","``","'opened","'","``","or","``","'closed","'","``",".","mpos",":","str","Market","position","``","'long","'","``","or","``","'short","'","``",".","quantity",":","float","The","net","size","of","the","position",".","price",":","float","The","current","price","of","the","instrument",".","value",":","float","The","total","dollar","value","of","the","position",".","profit",":","float","The","net","profit","of","the","current","position",".","netreturn",":","float","The","Return","On","Investment","(","ROI",")",",","or","net","return",".","opened",":","datetime","Date","the","position","is","opened",".","held",":","int","The","holding","period","since","the","position","was","opened",".","costbasis",":","float","Overall","cost","basis",".","trades",":","list","of","Trade","The","executed","trades","for","the","position","so","far",".","ntrades",":","int","Total","number","of","trades",".","pdata",":","pandas","DataFrame","Price","data","for","the","given","``","name","``",".","multiplier",":","float","Multiple","for","instrument","type","(","e.g.",",","1.0","for","stocks",")","."]
code: def __init__(self, portfolio, name, opendate):
      space = portfolio.space
      self.date = opendate
      self.name = name
      self.status = "opened"
      self.mpos = "flat"
      self.quantity = 0
      self.price = 0.0
      self.value = 0.0
      self.profit = 0.0
      self.netreturn = 0.0
      self.opened = opendate
      self.held = 0
      self.costbasis = 0.0
      self.trades = []
      self.ntrades = 0
      self.pdata = Frame.frames[frame_name(name, space)].df
      self.multiplier = MULTIPLIERS[space.subject]
  
imports: from alphapy.frame import Frame
  from alphapy.frame import frame_name
  from alphapy.frame import read_frame
  from alphapy.frame import write_frame
  from alphapy.globals import MULTIPLIERS, SSEP
  from alphapy.globals import Orders
  from alphapy.space import Space
  import logging
  import math
  import numpy
  from pandas import DataFrame
  from pandas import date_range
  from pandas import Series
label_desc: Use image node_id 1 to create a new Position object  with example: obj = Position(portfolio, name, opendate)