This repository has been archived by the owner on Jan 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0352893
commit 11e3225
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Change Log | ||
========== | ||
|
||
### 01/13/2020 - 1.3 | ||
* Added `positions()` class with access to Alpaca positions endpoints. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php namespace Alpaca\Account; | ||
|
||
class Positions | ||
{ | ||
|
||
/** | ||
* Response array | ||
* | ||
* @var Alpaca\Alpaca | ||
*/ | ||
private $alpaca; | ||
|
||
/** | ||
* __construct | ||
* | ||
*/ | ||
public function __construct(\Alpaca\Alpaca $alpaca) | ||
{ | ||
$this->alpaca = $alpaca; | ||
} | ||
|
||
/** | ||
* get() | ||
* | ||
* @return array | ||
*/ | ||
public function get($stock) | ||
{ | ||
return $this->alpaca->request('position',['stock'=>$stock])->results(); | ||
} | ||
|
||
/** | ||
* getAll() | ||
* | ||
* @return array | ||
*/ | ||
public function getAll() | ||
{ | ||
return $this->alpaca->request('positions',[])->results(); | ||
} | ||
|
||
/** | ||
* close() | ||
* | ||
* @return array | ||
*/ | ||
public function close($stock) | ||
{ | ||
return $this->alpaca->request('position',['stock'=>$stock],'DELETE')->results(); | ||
} | ||
|
||
/** | ||
* closeAll() | ||
* | ||
* @return array | ||
*/ | ||
public function closeAll() | ||
{ | ||
return $this->alpaca->request('positions',[],'DELETE')->results(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters