Skip to content

Commit c5971ac

Browse files
author
Raunak Gupta
committed
Initial commit.
1 parent ba3a94a commit c5971ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+24881
-0
lines changed

.gitignore

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Project Specific #
2+
####################
3+
/src/cache/
4+
.env
5+
.php-cs-fixer.cache
6+
7+
# Composer #
8+
############
9+
composer.phar
10+
composer.lock
11+
/vendor/
12+
13+
14+
# NPM #
15+
#######
16+
/dist
17+
/node_modules
18+
/logs
19+
.cache
20+
coverage
21+
nodemon.json
22+
23+
# Compiled Python files #
24+
#########################
25+
*.pyc
26+
27+
# backup files generated by text editors #
28+
##########################################
29+
*~
30+
31+
32+
# OS generated files #
33+
######################
34+
.DS_Store
35+
.DS_Store?
36+
Desktop.ini
37+
.local.env
38+
.env.backup
39+
40+
41+
# Thumbnail cache files #
42+
#########################
43+
._*
44+
Thumbs.db
45+
46+
47+
# IDE #
48+
#######
49+
50+
### NetBeans ###
51+
nbproject/*
52+
build/
53+
nbbuild/
54+
nbdist/
55+
.nb-gradle/
56+
57+
### PhpStorm/WebStrom ###
58+
.idea/*
59+
60+
### VisualStudioCode ###
61+
.vscode/*
62+
*.code-workspace
63+
64+
# Local History for Visual Studio Code
65+
.history/
66+
67+
### VisualStudioCode Patch ###
68+
# Ignore all local history of files
69+
.history
70+
.ionide

.php-cs-fixer.dist.php

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$rules = [
7+
'array_syntax' => ['syntax' => 'short'],
8+
9+
'blank_line_after_namespace' => true,
10+
'blank_line_after_opening_tag' => true,
11+
'braces' => true,
12+
'cast_spaces' => true,
13+
'concat_space' => [
14+
'spacing' => 'none',
15+
],
16+
'declare_equal_normalize' => true,
17+
'elseif' => true,
18+
'encoding' => true,
19+
'full_opening_tag' => true,
20+
'fully_qualified_strict_types' => true, // added by Shift
21+
'function_declaration' => true,
22+
'function_typehint_space' => true,
23+
'heredoc_to_nowdoc' => true,
24+
'include' => true,
25+
'increment_style' => ['style' => 'post'],
26+
'indentation_type' => true,
27+
'linebreak_after_opening_tag' => true,
28+
'line_ending' => true,
29+
'lowercase_cast' => true,
30+
'lowercase_keywords' => true,
31+
'lowercase_static_reference' => true, // added from Symfony
32+
'magic_method_casing' => true, // added from Symfony
33+
'magic_constant_casing' => true,
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline'
36+
],
37+
'native_function_casing' => true,
38+
'no_alias_functions' => true,
39+
'no_extra_blank_lines' => [
40+
'tokens' => [
41+
'extra',
42+
'throw',
43+
'use',
44+
],
45+
],
46+
'no_blank_lines_after_class_opening' => true,
47+
'no_blank_lines_after_phpdoc' => true,
48+
'no_break_comment' => true,
49+
'no_space_around_double_colon' => true,
50+
'no_closing_tag' => true,
51+
'no_empty_phpdoc' => true,
52+
'no_empty_statement' => true,
53+
'no_leading_import_slash' => true,
54+
'no_leading_namespace_whitespace' => true,
55+
'no_mixed_echo_print' => [
56+
'use' => 'echo',
57+
],
58+
'no_multiline_whitespace_around_double_arrow' => true,
59+
'multiline_whitespace_before_semicolons' => [
60+
'strategy' => 'no_multi_line',
61+
],
62+
'no_short_bool_cast' => true,
63+
'no_singleline_whitespace_before_semicolons' => true,
64+
'no_spaces_after_function_name' => true,
65+
'no_spaces_inside_parenthesis' => true,
66+
'no_trailing_comma_in_list_call' => true,
67+
'no_trailing_comma_in_singleline_array' => true,
68+
'no_trailing_whitespace' => true,
69+
'no_trailing_whitespace_in_comment' => true,
70+
'no_unreachable_default_argument_value' => true,
71+
'no_useless_return' => true,
72+
'no_whitespace_before_comma_in_array' => true,
73+
'no_whitespace_in_blank_line' => true,
74+
'normalize_index_brace' => true,
75+
'not_operator_with_successor_space' => false,
76+
'object_operator_without_whitespace' => true,
77+
'phpdoc_indent' => true,
78+
'phpdoc_no_access' => true,
79+
'phpdoc_no_package' => true,
80+
'phpdoc_no_useless_inheritdoc' => true,
81+
'phpdoc_scalar' => true,
82+
'phpdoc_single_line_var_spacing' => true,
83+
'phpdoc_summary' => true,
84+
'phpdoc_to_comment' => true,
85+
'phpdoc_trim' => true,
86+
'phpdoc_types' => true,
87+
'phpdoc_var_without_name' => true,
88+
'self_accessor' => true,
89+
'short_scalar_cast' => true,
90+
'simplified_null_return' => false, // disabled by Shift
91+
'single_blank_line_at_eof' => true,
92+
'single_blank_line_before_namespace' => true,
93+
'single_import_per_statement' => true,
94+
'single_line_after_imports' => true,
95+
'single_line_comment_style' => [
96+
'comment_types' => ['hash'],
97+
],
98+
'single_class_element_per_statement' => [
99+
'elements' => ['property'],
100+
],
101+
'single_quote' => true,
102+
'space_after_semicolon' => true,
103+
'standardize_not_equals' => true,
104+
'switch_case_semicolon_to_colon' => true,
105+
'switch_case_space' => true,
106+
'ternary_operator_spaces' => true,
107+
'trim_array_spaces' => true,
108+
'unary_operator_spaces' => true,
109+
'whitespace_after_comma_in_array' => true,
110+
111+
// php-cs-fixer 3: Renamed rules
112+
'constant_case' => ['case' => 'lower'],
113+
'general_phpdoc_tag_rename' => true,
114+
'phpdoc_inline_tag_normalizer' => true,
115+
'phpdoc_tag_type' => true,
116+
'psr_autoloading' => true,
117+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
118+
119+
// php-cs-fixer 3: Changed options
120+
'binary_operator_spaces' => [
121+
'default' => 'single_space',
122+
'operators' => ['=>' => null],
123+
],
124+
'blank_line_before_statement' => [
125+
'statements' => ['return'],
126+
],
127+
'class_attributes_separation' => [
128+
'elements' => [
129+
'const' => 'one',
130+
'method' => 'one',
131+
'property' => 'one',
132+
'trait_import' => 'none',
133+
],
134+
],
135+
'class_definition' => [
136+
'multi_line_extends_each_single_line' => true,
137+
'single_item_single_line' => true,
138+
'single_line' => true,
139+
],
140+
'ordered_imports' => [
141+
'sort_algorithm' => 'alpha',
142+
],
143+
'no_unused_imports' => true,
144+
145+
// php-cs-fixer 3: Removed rootless options (*)
146+
'no_unneeded_control_parentheses' => [
147+
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'],
148+
],
149+
'no_spaces_around_offset' => [
150+
'positions' => ['inside', 'outside'],
151+
],
152+
'visibility_required' => [
153+
'elements' => ['property', 'method', 'const'],
154+
],
155+
];
156+
157+
158+
$finder = Finder::create()
159+
->in([
160+
__DIR__ . '/src',
161+
])
162+
->name('*.php')
163+
// ->notName('*.dist.php')
164+
->ignoreDotFiles(true)
165+
->ignoreVCS(true);
166+
167+
$config = new Config();
168+
return $config->setFinder($finder)
169+
->setRules($rules)
170+
->setRiskyAllowed(true)
171+
->setUsingCache(false);

composer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "finally-raunak/wazirx-porfolio-tracker",
3+
"description": "Free and open source solution to track your Wazirx Portfolio",
4+
"homepage": "https://github.com/finallyRaunak/wazirx-porfolio-tracker/",
5+
"type":"project",
6+
"readme": "./README.md",
7+
"keywords": [
8+
"wazirx",
9+
"wazirx-php-sdk",
10+
"crypto",
11+
"porfolio-tracker"
12+
],
13+
"license": "MIT",
14+
"authors": [
15+
{
16+
"name": "Raunak Gupta",
17+
"email": "[email protected]",
18+
"homepage": "https://www.webhat.in/article/author/raunak-gupta/",
19+
"role": "Developer"
20+
}
21+
],
22+
"require": {
23+
"phpfastcache/phpfastcache": "^8.1",
24+
"ext-curl": "*",
25+
"php": ">=7.1"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"BalanceSheet\\": "src/"
30+
},
31+
"files": [
32+
"src/constants.php",
33+
"src/utility.php"
34+
]
35+
},
36+
"require-dev": {
37+
"friendsofphp/php-cs-fixer": "^3.0.0"
38+
},
39+
"scripts": {
40+
"lint": "./vendor/bin/php-cs-fixer fix -vvv --dry-run --show-progress=dots",
41+
"lint:fix": "./vendor/bin/php-cs-fixer fix -vvv --show-progress=dots",
42+
"clear:cache": "rm -rf ./src/cache/*"
43+
},
44+
"scripts-descriptions": {
45+
"lint": "Run the php-cs-fixer script and list all the errors, which voiles defined rules.",
46+
"lint:fix": "Run the php-cs-fixer script and auto fix all the errors, which voiles defined rules.",
47+
"clear:cache": "Clear or remove all the crypto cached information."
48+
},
49+
"support": {
50+
"issues": "https://github.com/finallyRaunak/wazirx-porfolio-tracker/issues",
51+
"forum": "https://github.com/finallyRaunak/wazirx-porfolio-tracker/discussions",
52+
"docs": "https://github.com/finallyRaunak/wazirx-porfolio-tracker/blob/main/doc/README.md"
53+
}
54+
}

index.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
session_start();
3+
require_once 'vendor/autoload.php';
4+
5+
if(!APP_DEBUG){
6+
error_reporting(0);
7+
}
8+
else{
9+
error_reporting(E_ERROR | E_WARNING | E_PARSE);
10+
}
11+
12+
if (!empty(filter_input(INPUT_POST, 'consent', FILTER_SANITIZE_STRING))) {
13+
if ($_SESSION['csrf_token'] !== filter_input(INPUT_POST, 'csrf_token', FILTER_SANITIZE_STRING)) {
14+
15+
// CSRF miss-match so redirecting to home page
16+
header('Location: '. getSiteURL('/'));
17+
die();
18+
}
19+
$tradingPair = !empty(filter_input(INPUT_POST, 'trading_pair', FILTER_DEFAULT , FILTER_REQUIRE_ARRAY)) ? $_POST['trading_pair'] : ['inr'];
20+
$apiKey = $_SESSION['api_key'] = filter_input(INPUT_POST, 'api_key', FILTER_SANITIZE_STRING);
21+
$apiSecret = $_SESSION['api_secret'] = filter_input(INPUT_POST, 'api_secret', FILTER_SANITIZE_STRING);
22+
23+
$obj = new \BalanceSheet\BalanceSheet();
24+
$obj->listOrders($apiKey, $apiSecret, $tradingPair);
25+
die();
26+
}
27+
28+
$obj = new \BalanceSheet\BalanceSheet();
29+
$obj->index();

0 commit comments

Comments
 (0)