Skip to content

Commit 2f4b9a3

Browse files
committed
Created the Trader class and the TraderTest class.
1 parent 885dc25 commit 2f4b9a3

File tree

2 files changed

+1107
-0
lines changed

2 files changed

+1107
-0
lines changed

Tests/TraderTest.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../source/Trader.php';
4+
5+
class TraderTest extends PHPUnit_Framework_TestCase
6+
{
7+
public function testConstants()
8+
{
9+
$this->assertEquals(TRADER_MA_TYPE_SMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_SMA);
10+
$this->assertEquals(TRADER_MA_TYPE_EMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_EMA);
11+
$this->assertEquals(TRADER_MA_TYPE_WMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_WMA);
12+
$this->assertEquals(TRADER_MA_TYPE_DEMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_DEMA);
13+
$this->assertEquals(TRADER_MA_TYPE_TEMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_TEMA);
14+
$this->assertEquals(TRADER_MA_TYPE_TRIMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_TRIMA);
15+
$this->assertEquals(TRADER_MA_TYPE_KAMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_KAMA);
16+
$this->assertEquals(TRADER_MA_TYPE_MAMA, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_MAMA);
17+
$this->assertEquals(TRADER_MA_TYPE_T3, \LupeCode\phpTraderInterface\Trader::TRADER_MA_TYPE_T3);
18+
$this->assertEquals(TRADER_REAL_MIN, \LupeCode\phpTraderInterface\Trader::TRADER_REAL_MIN);
19+
$this->assertEquals(TRADER_REAL_MAX, \LupeCode\phpTraderInterface\Trader::TRADER_REAL_MAX);
20+
$this->assertEquals(TRADER_FUNC_UNST_ADX, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ADX);
21+
$this->assertEquals(TRADER_FUNC_UNST_ADXR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ADXR);
22+
$this->assertEquals(TRADER_FUNC_UNST_ATR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ATR);
23+
$this->assertEquals(TRADER_FUNC_UNST_CMO, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_CMO);
24+
$this->assertEquals(TRADER_FUNC_UNST_DX, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_DX);
25+
$this->assertEquals(TRADER_FUNC_UNST_EMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_EMA);
26+
$this->assertEquals(TRADER_FUNC_UNST_HT_DCPERIOD, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_DCPERIOD);
27+
$this->assertEquals(TRADER_FUNC_UNST_HT_DCPHASE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_DCPHASE);
28+
$this->assertEquals(TRADER_FUNC_UNST_HT_PHASOR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_PHASOR);
29+
$this->assertEquals(TRADER_FUNC_UNST_HT_TRENDLINE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_TRENDLINE);
30+
$this->assertEquals(TRADER_FUNC_UNST_HT_TRENDMODE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_HT_TRENDMODE);
31+
$this->assertEquals(TRADER_FUNC_UNST_KAMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_KAMA);
32+
$this->assertEquals(TRADER_FUNC_UNST_MAMA, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MAMA);
33+
$this->assertEquals(TRADER_FUNC_UNST_MFI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MFI);
34+
$this->assertEquals(TRADER_FUNC_UNST_MINUS_DI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MINUS_DI);
35+
$this->assertEquals(TRADER_FUNC_UNST_MINUS_DM, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_MINUS_DM);
36+
$this->assertEquals(TRADER_FUNC_UNST_NATR, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_NATR);
37+
$this->assertEquals(TRADER_FUNC_UNST_PLUS_DI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_PLUS_DI);
38+
$this->assertEquals(TRADER_FUNC_UNST_PLUS_DM, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_PLUS_DM);
39+
$this->assertEquals(TRADER_FUNC_UNST_RSI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_RSI);
40+
$this->assertEquals(TRADER_FUNC_UNST_STOCHRSI, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_STOCHRSI);
41+
$this->assertEquals(TRADER_FUNC_UNST_T3, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_T3);
42+
$this->assertEquals(TRADER_FUNC_UNST_ALL, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_ALL);
43+
$this->assertEquals(TRADER_FUNC_UNST_NONE, \LupeCode\phpTraderInterface\Trader::TRADER_FUNC_UNST_NONE);
44+
$this->assertEquals(TRADER_COMPATIBILITY_DEFAULT, \LupeCode\phpTraderInterface\Trader::TRADER_COMPATIBILITY_DEFAULT);
45+
$this->assertEquals(TRADER_COMPATIBILITY_METASTOCK, \LupeCode\phpTraderInterface\Trader::TRADER_COMPATIBILITY_METASTOCK);
46+
$this->assertEquals(TRADER_ERR_SUCCESS, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_SUCCESS);
47+
$this->assertEquals(TRADER_ERR_LIB_NOT_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_LIB_NOT_INITIALIZE);
48+
$this->assertEquals(TRADER_ERR_BAD_PARAM, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_BAD_PARAM);
49+
$this->assertEquals(TRADER_ERR_ALLOC_ERR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_ALLOC_ERR);
50+
$this->assertEquals(TRADER_ERR_GROUP_NOT_FOUND, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_GROUP_NOT_FOUND);
51+
$this->assertEquals(TRADER_ERR_FUNC_NOT_FOUND, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_FUNC_NOT_FOUND);
52+
$this->assertEquals(TRADER_ERR_INVALID_HANDLE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_HANDLE);
53+
$this->assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_HOLDER);
54+
$this->assertEquals(TRADER_ERR_INVALID_PARAM_HOLDER_TYPE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_HOLDER_TYPE);
55+
$this->assertEquals(TRADER_ERR_INVALID_PARAM_FUNCTION, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_PARAM_FUNCTION);
56+
$this->assertEquals(TRADER_ERR_INPUT_NOT_ALL_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INPUT_NOT_ALL_INITIALIZE);
57+
$this->assertEquals(TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE);
58+
$this->assertEquals(TRADER_ERR_OUT_OF_RANGE_START_INDEX, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUT_OF_RANGE_START_INDEX);
59+
$this->assertEquals(TRADER_ERR_OUT_OF_RANGE_END_INDEX, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_OUT_OF_RANGE_END_INDEX);
60+
$this->assertEquals(TRADER_ERR_INVALID_LIST_TYPE, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INVALID_LIST_TYPE);
61+
$this->assertEquals(TRADER_ERR_BAD_OBJECT, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_BAD_OBJECT);
62+
$this->assertEquals(TRADER_ERR_NOT_SUPPORTED, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_NOT_SUPPORTED);
63+
$this->assertEquals(TRADER_ERR_INTERNAL_ERROR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_INTERNAL_ERROR);
64+
$this->assertEquals(TRADER_ERR_UNKNOWN_ERROR, \LupeCode\phpTraderInterface\Trader::TRADER_ERR_UNKNOWN_ERROR);
65+
}
66+
}

0 commit comments

Comments
 (0)