-
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.
Merge pull request #3 from timirey/feature/refactor-with-enum
Feature/refactor with enum
- Loading branch information
Showing
28 changed files
with
502 additions
and
65 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
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,49 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the command type for a trade. | ||
*/ | ||
enum Cmd: int | ||
{ | ||
/** | ||
* Buy command. | ||
*/ | ||
case BUY = 0; | ||
|
||
/** | ||
* Sell command. | ||
*/ | ||
case SELL = 1; | ||
|
||
/** | ||
* Buy limit order. | ||
*/ | ||
case BUY_LIMIT = 2; | ||
|
||
/** | ||
* Sell limit order. | ||
*/ | ||
case SELL_LIMIT = 3; | ||
|
||
/** | ||
* Buy stop order. | ||
*/ | ||
case BUY_STOP = 4; | ||
|
||
/** | ||
* Sell stop order. | ||
*/ | ||
case SELL_STOP = 5; | ||
|
||
/** | ||
* Balance operation (read only). | ||
*/ | ||
case BALANCE = 6; | ||
|
||
/** | ||
* Credit operation (read only). | ||
*/ | ||
case CREDIT = 7; | ||
} |
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,44 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the day of the week. | ||
*/ | ||
enum Day: int | ||
{ | ||
/** | ||
* Monday. | ||
*/ | ||
case MONDAY = 1; | ||
|
||
/** | ||
* Tuesday. | ||
*/ | ||
case TUESDAY = 2; | ||
|
||
/** | ||
* Wednesday. | ||
*/ | ||
case WEDNESDAY = 3; | ||
|
||
/** | ||
* Thursday. | ||
*/ | ||
case THURSDAY = 4; | ||
|
||
/** | ||
* Friday. | ||
*/ | ||
case FRIDAY = 5; | ||
|
||
/** | ||
* Saturday. | ||
*/ | ||
case SATURDAY = 6; | ||
|
||
/** | ||
* Sunday. | ||
*/ | ||
case SUNDAY = 7; | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the impact level. | ||
*/ | ||
enum Impact: string | ||
{ | ||
/** | ||
* Low impact. | ||
*/ | ||
case LOW = "1"; | ||
|
||
/** | ||
* Medium impact. | ||
*/ | ||
case MEDIUM = "2"; | ||
|
||
/** | ||
* High impact. | ||
*/ | ||
case HIGH = "3"; | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the price level. | ||
*/ | ||
enum Level: int | ||
{ | ||
/** | ||
* All available levels. | ||
*/ | ||
case ALL = -1; | ||
|
||
/** | ||
* Base level bid and ask price for instrument. | ||
*/ | ||
case BASE = 0; | ||
|
||
/** | ||
* Specified level. | ||
*/ | ||
case SPECIFIED = 1; | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the margin mode. | ||
*/ | ||
enum MarginMode: int | ||
{ | ||
/** | ||
* Forex. | ||
*/ | ||
case FOREX = 101; | ||
|
||
/** | ||
* CFD leveraged. | ||
*/ | ||
case CFD_LEVERAGED = 102; | ||
|
||
/** | ||
* CFD. | ||
*/ | ||
case CFD = 103; | ||
} |
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,54 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the period. | ||
*/ | ||
enum Period: int | ||
{ | ||
/** | ||
* 1 minute. | ||
*/ | ||
case PERIOD_M1 = 1; | ||
|
||
/** | ||
* 5 minutes. | ||
*/ | ||
case PERIOD_M5 = 5; | ||
|
||
/** | ||
* 15 minutes. | ||
*/ | ||
case PERIOD_M15 = 15; | ||
|
||
/** | ||
* 30 minutes. | ||
*/ | ||
case PERIOD_M30 = 30; | ||
|
||
/** | ||
* 60 minutes (1 hour). | ||
*/ | ||
case PERIOD_H1 = 60; | ||
|
||
/** | ||
* 240 minutes (4 hours). | ||
*/ | ||
case PERIOD_H4 = 240; | ||
|
||
/** | ||
* 1440 minutes (1 day). | ||
*/ | ||
case PERIOD_D1 = 1440; | ||
|
||
/** | ||
* 10080 minutes (1 week). | ||
*/ | ||
case PERIOD_W1 = 10080; | ||
|
||
/** | ||
* 43200 minutes (30 days). | ||
*/ | ||
case PERIOD_MN1 = 43200; | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the profit mode. | ||
*/ | ||
enum ProfitMode: int | ||
{ | ||
/** | ||
* FOREX. | ||
*/ | ||
case FOREX = 5; | ||
|
||
/** | ||
* CFD. | ||
*/ | ||
case CFD = 6; | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the source of price. | ||
*/ | ||
enum QuoteId: int | ||
{ | ||
/** | ||
* Fixed source. | ||
*/ | ||
case FIXED = 1; | ||
|
||
/** | ||
* Float source. | ||
*/ | ||
case FLOAT = 2; | ||
|
||
/** | ||
* Depth source. | ||
*/ | ||
case DEPTH = 3; | ||
|
||
/** | ||
* Cross source. | ||
*/ | ||
case CROSS = 4; | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the request status. | ||
*/ | ||
enum RequestStatus: int | ||
{ | ||
/** | ||
* Error status. | ||
*/ | ||
case ERROR = 0; | ||
|
||
/** | ||
* Pending status. | ||
*/ | ||
case PENDING = 1; | ||
|
||
/** | ||
* Accepted status. The transaction has been executed successfully. | ||
*/ | ||
case ACCEPTED = 3; | ||
|
||
/** | ||
* Rejected status. The transaction has been rejected. | ||
*/ | ||
case REJECTED = 4; | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Timirey\XApi\Enums; | ||
|
||
/** | ||
* Enum representing the side of a trade. | ||
*/ | ||
enum Side: int | ||
{ | ||
/** | ||
* Buy side. | ||
*/ | ||
case BUY = 0; | ||
|
||
/** | ||
* Sell side. | ||
*/ | ||
case SELL = 1; | ||
} |
Oops, something went wrong.