作者 karlet

feat:复制实例

@@ -96,6 +96,19 @@ class CmBroker @@ -96,6 +96,19 @@ class CmBroker
96 } 96 }
97 $this->init(); 97 $this->init();
98 } 98 }
  99 + //复制一个新的实例
  100 + public function copy()
  101 + {
  102 + $apiInfo = new ApiInfo($this->apiInfo->key, $this->apiInfo->secret, $this->apiInfo->passphrase);
  103 + $cmBroker = new CmBroker($this->plat, $apiInfo);
  104 + $cmBroker->symbolInfos = $this->symbolInfos;
  105 + $cmBroker->positions = $this->positions;
  106 + $cmBroker->name = $this->name;
  107 + $cmBroker->levers = $this->levers;
  108 + $cmBroker->uid = $this->uid;
  109 + $cmBroker->posMode = $this->posMode;
  110 + return $cmBroker;
  111 + }
99 public function setName($name) 112 public function setName($name)
100 { 113 {
101 $this->name = $name; 114 $this->name = $name;